Armand Bozsik

PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
Jul 17, 2021 16:30
Hello,

I have a nicely working basic install of Laravel JetStream and Spatie's laravel-permission in Laravel 8.

I can assign a role to the user during registration via

$user->assignRole('visitor');
return $user;

(in CreateNewUser.php)

Can also restrict the available menu items on the user's dashboard through the permissions I have assigned to the role in my seeder files run method:

Permission::create(['name' => 'access profile']);
Permission::create(['name' => 'access logout']);

$visitor = Role::create(['name' => 'visitor']);