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.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners