nyoncode/laravel-permission-extended
composer require nyoncode/laravel-permission-extended
php artisan permission-extended:install
The install command will:
config/permission-extended.phpChange the HasRoles import — from Spatie to this package:
// Before: use Spatie\Permission\Traits\HasRoles;
// After:
use NyonCode\PermissionExtended\Traits\HasRoles;
class User extends Authenticatable
{
use HasRoles;
}
Do not use both Spatie's and this package's HasRoles on the same model.
$user = User::first();
$user->givePermissionTo('admin.create');
$user->hasPermissionTo('admin.*'); // true
$user->can('admin.*'); // true (via Gate)
How can I help you explore Laravel packages today?