# Installation
Install the package via composer:
composer require bpuig/laravel-subby
Publish the configuration:
php artisan vendor:publish --tag=subby.config
Publish migrations:
php artisan vendor:publish --tag=subby.migrations
Migrate:
php artisan migrate
# Upgrade from v6.x to v7.x
This package need to be upgraded version by version to apply database changes. See migrate v7.x for breaking changes.
# Attach Subscriptions to model
Laravel Subby has been specially made for Eloquent. To add Subscription functionality to your User model just use
the \Bpuig\Subby\Traits\HasSubscriptions
trait like this:
namespace App\Models;
use Bpuig\Subby\Traits\HasSubscriptions;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasSubscriptions;
}
That's it, we only have to use that trait in our User model or any other model! Now your users may subscribe to plans. Then you can import package's models wherever you need them or extend them in your own models.