# Installation
- You can install the package using composer:
composer require santigarcor/laratrust
- Publish the configuration file:
php artisan vendor:publish --tag="laratrust"
WARNING
If this command did not publish any files, chances are, the Laratrust service provider hasn't been registered. Try clearing your configuration cache
php artisan config:clear
- Run the setup command:
IMPORTANT
Before running the command go to your config/laratrust.php
file and change the values according to your needs.
php artisan laratrust:setup
This command will generate the migrations, create the Role
and Permission
models (if you are using the teams feature it will also create a Team
model).
- Add the
Laratrust\Contracts\LaratrustUser
interface andLaratrust\Traits\HasRolesAndPermissions
trait in your user classes.
use Laratrust\Contracts\LaratrustUser;
use Laratrust\Traits\HasRolesAndPermissions;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements LaratrustUser
{
use HasRolesAndPermissions;
// ...
}
- Dump the autoloader:
composer dump-autoload
- Run the migrations:
php artisan migrate
IMPORTANT
If you did the steps above you are done with the configuration, if not, please read and follow the whole configuration process