dev-master
9999999-dev
The Requires
by Jānis Blaus
by Gustavs Racenajs
1.0.x-dev
1.0.9999999.9999999-dev
The Requires
by Gustavs Racenajs
Wallogit.com
2017 © Pedro Peláez
This module allows you to manage subscription plans and let users to subscribe to plans., (*1)
Only use this module if you are using a fully custom payment method. If you use Laravel Cashier, there's support coming for that!, (*2)
This package is part of Netcore CMS ecosystem and is only functional in a project that has the following packages installed:, (*3)
composer require netcore/module-subscription
php artisan module:publish-config Subscription php artisan module:publish-migration Subscription php artisan migrate
Configure plans and billing periods in config/netcore/module-subscription.php file., (*4)
Seed the configuration to database, (*5)
php artisan module:seed Subscription
Modules\Subscription\Traits\Subscribable trait to your User model$plan = Modules\Subscription\Models\Plan::where('key', 'premium')->first();
$planPrice = $plan->prices()->inPeriod('monthly')->first();
$user = App\User::first();
$user->subscribe($planPrice, true);
/*
The boolean stands for whether the user has already paid for the subscription or not.
If a boolean is not provided, it'll be automatically set to false.
*/
$plan = $user->plan;
$subscription = $user->subscription; $expirationDate = $subscription->expires_at; $userHasPaid = $subscription->is_paid;
$user->cancelSubscription();
$user->renewSubscription(true); // The boolean stands for whether the user has already paid for the subscription or not