Laravel Soulbscription is a fantastic package that provides a straightforward interface to handle subscriptions and feature consumption. The package migrations are loaded automatically, but you can still publish them with this command: php artisan vendor:publish --tag="soulbscription-migrations" php artisan migrate To start using it, you just have to add the given trait to your User model (or any entity you want to have subscriptions): true, 'name' => 'deploy-minutes', 'periodicity_type' => PeriodicityType::Day, 'periodicity' => 1, ]); $customDomain = Feature::create([ 'consumable' => false, 'name' => 'custom-domain', ]); }} Now you need to define the plans available for subscription in your app: 'silver', 'periodicity_type' => PeriodicityType::Month, 'periodicity' => 1, ]); $gold = Plan::create([ 'name' => 'gold', 'periodicity_type' => PeriodicityType::Month, 'periodicity' => 1, ]); }}
$deployMinutes = Feature::whereName('deploy-minutes')->first(); $subdomains = Feature::whereName('subdomains')->first(); $silver->features()->attach($deployMinutes, ['charges' => 15]); $gold->features()->attach($deployMinutes, ['charges' => 25]); $gold->features()->attach($subdomains); It is necessary to pass a value to charges when associating a consumable feature with a plan.