From 13b88b2e91fff39aa0c1488327d4416a0820cff1 Mon Sep 17 00:00:00 2001 From: Mansi Prajapati Date: Fri, 2 Feb 2024 16:47:43 +0530 Subject: [PATCH 1/2] changed namespace --- CHANGELOG.md | 4 +-- composer.json | 8 ++--- docs/eloquent_scopes.rst | 2 +- docs/events.rst | 8 ++--- docs/install.rst | 8 ++--- docs/usage.rst | 10 +++--- .../Contracts/PlanFeatureInterface.php | 2 +- src/LaravelPlans/Contracts/PlanInterface.php | 2 +- .../Contracts/PlanSubscriberInterface.php | 2 +- .../Contracts/PlanSubscriptionInterface.php | 2 +- .../PlanSubscriptionUsageInterface.php | 2 +- .../SubscriptionBuilderInterface.php | 4 +-- .../SubscriptionResolverInterface.php | 2 +- .../Events/SubscriptionCanceled.php | 4 +-- .../Events/SubscriptionCreated.php | 6 ++-- .../Events/SubscriptionPlanChanged.php | 8 ++--- .../Events/SubscriptionRenewed.php | 8 ++--- ...eatureValueFormatIncompatibleException.php | 2 +- .../Exceptions/InvalidIntervalException.php | 2 +- .../InvalidPlanFeatureException.php | 2 +- src/LaravelPlans/Feature.php | 8 ++--- .../LaravelPlansServiceProvider.php | 18 +++++------ src/LaravelPlans/Models/Plan.php | 8 ++--- src/LaravelPlans/Models/PlanFeature.php | 6 ++-- src/LaravelPlans/Models/PlanSubscription.php | 32 +++++++++---------- .../Models/PlanSubscriptionUsage.php | 4 +-- src/LaravelPlans/Period.php | 6 ++-- src/LaravelPlans/SubscriptionAbility.php | 4 +-- src/LaravelPlans/SubscriptionBuilder.php | 6 ++-- src/LaravelPlans/SubscriptionResolver.php | 4 +-- src/LaravelPlans/SubscriptionUsageManager.php | 6 ++-- src/LaravelPlans/Traits/BelongsToPlan.php | 2 +- src/LaravelPlans/Traits/PlanSubscriber.php | 20 ++++++------ src/config/laravelplans.php | 8 ++--- src/database/factories/PlanFactory.php | 2 +- src/database/factories/PlanFeatureFactory.php | 4 +-- .../factories/PlanSubscriptionFactory.php | 6 ++-- .../PlanSubscriptionUsageFactory.php | 4 +-- src/database/factories/UserFactory.php | 2 +- tests/Models/User.php | 6 ++-- tests/TestCase.php | 6 ++-- .../Models/PlanSubscriptionTest.php | 24 +++++++------- .../Models/PlanSubscriptionUsageTest.php | 10 +++--- tests/integration/Models/PlanTest.php | 10 +++--- tests/integration/SubscriptionAbilityTest.php | 10 +++--- tests/integration/SubscriptionBuilderTest.php | 10 +++--- .../SubscriptionUsageManagerTest.php | 14 ++++---- tests/unit/FeatureTest.php | 8 ++--- tests/unit/PeriodTest.php | 8 ++--- 49 files changed, 172 insertions(+), 172 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ddcc3..942d871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [UNRELEASED] ### Added -- Now the subscription returned by the `subscription()` method in the `PlanSubscriber` trait is resolved by a class compatible with `Czechbox\LaravelPlans\Contracts\SubscriptionResolverInterface`. Default resolver is `Czechbox\LaravelPlans\SubscriptionResolver`. Behavior and logic not changed. [Documentation](https://laraplans.readthedocs.io/en/latest/usage.html#subscription-resolving). +- Now the subscription returned by the `subscription()` method in the `PlanSubscriber` trait is resolved by a class compatible with `Concept\LaravelPlans\Contracts\SubscriptionResolverInterface`. Default resolver is `Concept\LaravelPlans\SubscriptionResolver`. Behavior and logic not changed. [Documentation](https://laraplans.readthedocs.io/en/latest/usage.html#subscription-resolving). ## [2.2.0] - 2018-02-23 @@ -43,7 +43,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - `SubscriptionPlanChanged` event. ### Changed -- Namespace changed from `Czechbox\LaraPlans` to `Czechbox\LaravelPlans` +- Namespace changed from `Czechbox\LaraPlans` to `Concept\LaravelPlans` ### Fixed - Fix #18 diff --git a/composer.json b/composer.json index bbf09da..f811408 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "czechbox/laravelplans", + "name": "mansi1695/laravelplans", "description": "SaaS style recurring plans for Laravel.", "keywords": ["plans", "laravel", "subscriptions", "memberships"], "license": "MIT", @@ -18,7 +18,7 @@ }, "autoload": { "psr-4": { - "Czechbox\\LaravelPlans\\": "src/LaravelPlans/" + "Concept\\LaravelPlans\\": "src/LaravelPlans/" } }, "autoload-dev": { @@ -26,13 +26,13 @@ "tests/TestCase.php" ], "psr-4": { - "Czechbox\\LaravelPlans\\Tests\\": "tests/" + "Concept\\LaravelPlans\\Tests\\": "tests/" } }, "extra": { "laravel": { "providers": [ - "Czechbox\\LaravelPlans\\LaravelPlansServiceProvider" + "Concept\\LaravelPlans\\LaravelPlansServiceProvider" ] } }, diff --git a/docs/eloquent_scopes.rst b/docs/eloquent_scopes.rst index b6222d6..842939c 100644 --- a/docs/eloquent_scopes.rst +++ b/docs/eloquent_scopes.rst @@ -3,7 +3,7 @@ Eloquent Scopes .. code-block:: php - use Czechbox\LaravelPlans\Models\PlanSubscription; + use Concept\LaravelPlans\Models\PlanSubscription; // Get subscriptions by plan: $subscriptions = PlanSubscription::byPlan($plan_id)->get(); diff --git a/docs/events.rst b/docs/events.rst index 419234c..52e7bc5 100644 --- a/docs/events.rst +++ b/docs/events.rst @@ -3,7 +3,7 @@ Events The following are the events fired by the package: -- ``Czechbox\LaravelPlans\Events\SubscriptionCreated``: Fired when a subscription is created. -- ``Czechbox\LaravelPlans\Events\SubscriptionRenewed``: Fired when a subscription is renewed using the ``renew()`` method. -- ``Czechbox\LaravelPlans\Events\SubscriptionCanceled``: Fired when a subscription is canceled using the ``cancel()`` method. -- ``Czechbox\LaravelPlans\Events\SubscriptionPlanChanged``: Fired when a subscription's plan is changed; it will be fired once the ``PlanSubscription`` model is saved. Plan change is determined by comparing the original and current value of ``plan_id``. \ No newline at end of file +- ``Concept\LaravelPlans\Events\SubscriptionCreated``: Fired when a subscription is created. +- ``Concept\LaravelPlans\Events\SubscriptionRenewed``: Fired when a subscription is renewed using the ``renew()`` method. +- ``Concept\LaravelPlans\Events\SubscriptionCanceled``: Fired when a subscription is canceled using the ``cancel()`` method. +- ``Concept\LaravelPlans\Events\SubscriptionPlanChanged``: Fired when a subscription's plan is changed; it will be fired once the ``PlanSubscription`` model is saved. Plan change is determined by comparing the original and current value of ``plan_id``. \ No newline at end of file diff --git a/docs/install.rst b/docs/install.rst index 39c6891..0177c1f 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -24,7 +24,7 @@ Publish package config file and migrations with the following command: .. code-block:: bash - php artisan vendor:publish --provider="Czechbox\LaravelPlans\LaravelPlansServiceProvider" + php artisan vendor:publish --provider="Concept\LaravelPlans\LaravelPlansServiceProvider" Depending on your use case, you may want to adjust the published migrations. If your User model id is a 'uuid' rather than 'increments', modify the ``plan_subscriptions`` schema in ``XXXX_XX-XX_XXXXXX_create_laravelplans_tables.php`` file as below. @@ -47,7 +47,7 @@ Then run migrations: Traits and Contracts -------------------- -Add ``Czechbox\LaravelPlans\Traits\PlanSubscriber`` trait and ``Czechbox\LaravelPlans\Contracts\PlanSubscriberInterface`` contract to your ``User`` model. +Add ``Concept\LaravelPlans\Traits\PlanSubscriber`` trait and ``Concept\LaravelPlans\Contracts\PlanSubscriberInterface`` contract to your ``User`` model. See the following example: @@ -56,8 +56,8 @@ See the following example: namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; - use Czechbox\LaravelPlans\Contracts\PlanSubscriberInterface; - use Czechbox\LaravelPlans\Traits\PlanSubscriber; + use Concept\LaravelPlans\Contracts\PlanSubscriberInterface; + use Concept\LaravelPlans\Traits\PlanSubscriber; class User extends Authenticatable implements PlanSubscriberInterface { diff --git a/docs/usage.rst b/docs/usage.rst index 1921cba..b687d0b 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -6,8 +6,8 @@ Create a Plan .. code-block:: php - use Czechbox\LaravelPlans\Models\Plan; - use Czechbox\LaravelPlans\Models\PlanFeature; + use Concept\LaravelPlans\Models\Plan; + use Concept\LaravelPlans\Models\PlanFeature; $plan = Plan::create([ 'name' => 'Pro', @@ -46,7 +46,7 @@ First, retrieve an instance of your subscriber model, which typically will be yo .. code-block:: php use Auth; - use Czechbox\LaravelPlans\Models\Plan; + use Concept\LaravelPlans\Models\Plan; $user = Auth::user(); $plan = Plan::find(1); @@ -58,7 +58,7 @@ The first argument passed to ``newSubscription`` method should be the name of th Subscription resolving ---------------------- -When you use the ``subscription()`` method (i.e., ``$user->subscription('main')``) in the subscribable model to retrieve a subscription, you will receive the latest subscription created of the subscribable and the subscription name. For example, if you subscribe *Jane Doe* to *Free plan*, and later to *Pro plan*, LaravelPlans will return the subscription with the *Pro plan* because it is the newest subscription available. If you have a different requirement you may use your own subscription resolver by binding an implementation of ``Czechbox\LaravelPlans\Contracts\SubscriptionResolverInterface`` to the `service container`__; like so: +When you use the ``subscription()`` method (i.e., ``$user->subscription('main')``) in the subscribable model to retrieve a subscription, you will receive the latest subscription created of the subscribable and the subscription name. For example, if you subscribe *Jane Doe* to *Free plan*, and later to *Pro plan*, LaravelPlans will return the subscription with the *Pro plan* because it is the newest subscription available. If you have a different requirement you may use your own subscription resolver by binding an implementation of ``Concept\LaravelPlans\Contracts\SubscriptionResolverInterface`` to the `service container`__; like so: .. __: https://laravel.com/docs/5.6/container#introduction @@ -177,7 +177,7 @@ To renew a subscription you may use the ``renew`` method available in the subscr .. caution:: Canceled subscriptions with an ended period can't be renewed. -``Czechbox\LaravelPlans\Events\SubscriptionRenewed`` event is fired when a subscription is renewed using the ``renew`` method. +``Concept\LaravelPlans\Events\SubscriptionRenewed`` event is fired when a subscription is renewed using the ``renew`` method. Cancel a Subscription --------------------- diff --git a/src/LaravelPlans/Contracts/PlanFeatureInterface.php b/src/LaravelPlans/Contracts/PlanFeatureInterface.php index 1ffe545..e7ed0cf 100644 --- a/src/LaravelPlans/Contracts/PlanFeatureInterface.php +++ b/src/LaravelPlans/Contracts/PlanFeatureInterface.php @@ -1,6 +1,6 @@ [ - 'plan' => 'Czechbox\LaravelPlans\Models\Plan', - 'plan_feature' => 'Czechbox\LaravelPlans\Models\PlanFeature', - 'plan_subscription' => 'Czechbox\LaravelPlans\Models\PlanSubscription', - 'plan_subscription_usage' => 'Czechbox\LaravelPlans\Models\PlanSubscriptionUsage', + 'plan' => 'Concept\LaravelPlans\Models\Plan', + 'plan_feature' => 'Concept\LaravelPlans\Models\PlanFeature', + 'plan_subscription' => 'Concept\LaravelPlans\Models\PlanSubscription', + 'plan_subscription_usage' => 'Concept\LaravelPlans\Models\PlanSubscriptionUsage', ], /* diff --git a/src/database/factories/PlanFactory.php b/src/database/factories/PlanFactory.php index b576780..b1fbfc5 100644 --- a/src/database/factories/PlanFactory.php +++ b/src/database/factories/PlanFactory.php @@ -1,6 +1,6 @@ define(Plan::class, function (Faker\Generator $faker) { return [ diff --git a/src/database/factories/PlanFeatureFactory.php b/src/database/factories/PlanFeatureFactory.php index 2e0f229..7aae179 100644 --- a/src/database/factories/PlanFeatureFactory.php +++ b/src/database/factories/PlanFeatureFactory.php @@ -1,7 +1,7 @@ define(PlanFeature::class, function (Faker\Generator $faker) { return [ diff --git a/src/database/factories/PlanSubscriptionFactory.php b/src/database/factories/PlanSubscriptionFactory.php index 1571f23..d787443 100644 --- a/src/database/factories/PlanSubscriptionFactory.php +++ b/src/database/factories/PlanSubscriptionFactory.php @@ -1,8 +1,8 @@ define(PlanSubscription::class, function (Faker\Generator $faker) { return [ diff --git a/src/database/factories/PlanSubscriptionUsageFactory.php b/src/database/factories/PlanSubscriptionUsageFactory.php index f119e6e..da1e71b 100644 --- a/src/database/factories/PlanSubscriptionUsageFactory.php +++ b/src/database/factories/PlanSubscriptionUsageFactory.php @@ -1,7 +1,7 @@ define(PlanSubscriptionUsage::class, function (Faker\Generator $faker) { return [ diff --git a/src/database/factories/UserFactory.php b/src/database/factories/UserFactory.php index 54ca428..d0666f2 100644 --- a/src/database/factories/UserFactory.php +++ b/src/database/factories/UserFactory.php @@ -1,6 +1,6 @@ define(User::class, function (Faker\Generator $faker) { return [ diff --git a/tests/Models/User.php b/tests/Models/User.php index 1767727..83ba2e1 100644 --- a/tests/Models/User.php +++ b/tests/Models/User.php @@ -1,10 +1,10 @@ registerEloquentFactory($app); // Set user model - $app['config']->set('auth.providers.users.model', '\Czechbox\LaravelPlans\Tests\Models\User'); + $app['config']->set('auth.providers.users.model', '\Concept\LaravelPlans\Tests\Models\User'); // set up database configuration $app['config']->set('database.default', 'testbench'); @@ -61,7 +61,7 @@ protected function getEnvironmentSetUp($app) */ public function getPackageProviders($app) { - return ['Czechbox\LaravelPlans\LaravelPlansServiceProvider']; + return ['Concept\LaravelPlans\LaravelPlansServiceProvider']; } /** diff --git a/tests/integration/Models/PlanSubscriptionTest.php b/tests/integration/Models/PlanSubscriptionTest.php index 4794f29..440b66a 100644 --- a/tests/integration/Models/PlanSubscriptionTest.php +++ b/tests/integration/Models/PlanSubscriptionTest.php @@ -2,22 +2,22 @@ // @codingStandardsIgnoreFile -namespace Czechbox\LaravelPlans\Tests\Integration\Models; +namespace Concept\LaravelPlans\Tests\Integration\Models; use Config; use Carbon\Carbon; -use Czechbox\LaravelPlans\Period; +use Concept\LaravelPlans\Period; use Illuminate\Support\Facades\Event; -use Czechbox\LaravelPlans\Models\Plan; -use Czechbox\LaravelPlans\Tests\TestCase; -use Czechbox\LaravelPlans\Tests\Models\User; -use Czechbox\LaravelPlans\Models\PlanFeature; -use Czechbox\LaravelPlans\Models\PlanSubscription; -use Czechbox\LaravelPlans\Events\SubscriptionCreated; -use Czechbox\LaravelPlans\Events\SubscriptionRenewed; -use Czechbox\LaravelPlans\Events\SubscriptionCanceled; -use Czechbox\LaravelPlans\Models\PlanSubscriptionUsage; -use Czechbox\LaravelPlans\Events\SubscriptionPlanChanged; +use Concept\LaravelPlans\Models\Plan; +use Concept\LaravelPlans\Tests\TestCase; +use Concept\LaravelPlans\Tests\Models\User; +use Concept\LaravelPlans\Models\PlanFeature; +use Concept\LaravelPlans\Models\PlanSubscription; +use Concept\LaravelPlans\Events\SubscriptionCreated; +use Concept\LaravelPlans\Events\SubscriptionRenewed; +use Concept\LaravelPlans\Events\SubscriptionCanceled; +use Concept\LaravelPlans\Models\PlanSubscriptionUsage; +use Concept\LaravelPlans\Events\SubscriptionPlanChanged; class PlanSubscriptionTest extends TestCase { diff --git a/tests/integration/Models/PlanSubscriptionUsageTest.php b/tests/integration/Models/PlanSubscriptionUsageTest.php index 152a950..af21502 100644 --- a/tests/integration/Models/PlanSubscriptionUsageTest.php +++ b/tests/integration/Models/PlanSubscriptionUsageTest.php @@ -1,13 +1,13 @@ Date: Fri, 2 Feb 2024 16:47:50 +0530 Subject: [PATCH 2/2] updated dependency --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f811408..7667a91 100644 --- a/composer.json +++ b/composer.json @@ -7,8 +7,8 @@ "require": { "php": ">=7.2", "nesbot/carbon": "~2.0", - "illuminate/support": "~6.0|~7.0|~8.0", - "illuminate/database": "~6.0|~7.0|~8.0" + "illuminate/support": "~6.0|~7.0|~8.0|~9.0|~10.0", + "illuminate/database": "~6.0|~7.0|~8.0|~9.0|~10.0" }, "require-dev": { "fzaninotto/faker": "~1.4",