This package can be used with Laravel 6.0 or higher.
Consult the Prerequisites page for important considerations regarding your User models!
This package publishes a
config/permission.php file. If you already have a file by that name, you must rename or remove it.
You can install the package via composer:
composer require spatie/laravel-permission
Optional: The service provider will automatically get registered. Or you may manually add the service provider in your
'providers' => [
You should publish the migration and the
config/permission.php config file with:
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
NOTE: If you are using UUIDs, see the Advanced section of the docs on UUID steps, before you continue. It explains some changes you may want to make to the migrations and config file before continuing. It also mentions important considerations after extending this package's models for UUID capability.
Clear your config cache. This package requires access to the
permission config. Generally it's bad practice to do config-caching in a development environment. If you've been caching configurations locally, clear your config cache with either of these commands:
php artisan optimize:clear
php artisan config:clear
Run the migrations: After the config and migration have been published and configured, you can create the tables for this package by running:
php artisan migrate
Add the necessary trait to your User model: Consult the Basic Usage section of the docs for how to get started using the features of this package.