composer require spatie/laravel-permission code example
Example: spatie/laravel-permission
// Install package
composer require spatie/laravel-permission
// config/app.php
'providers' => [
// ...
Spatie\Permission\PermissionServiceProvider::class,
];
// Publish config file
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
// Clear cache
php artisan optimize:clear
# or
php artisan config:clear
// Run migration to create tables
php artisan migrate