Man, Pinkary is getting better each day, I hope we move from X to here.
Santiago Garcia
@santigarcor
Laravel artisan, scuba diver, and full-stack developer. Crafting code and exploring depths.
• • 10 Posts • 305 Views
Hello Santiago. I am using the Laratrust package in my local project. I have created roles, permissions and assigned different permissions to each role. Assigned roles to users. Question, how to check the permissions of an authorized user role?
If you want to check roles you can do this:
$user->hasRole('admin');
If you want to check permissions you can do this:
$user->hasPermission('edit-user');
$user->isAbleTo('edit-user');
For more information, please check this out
laratrust.santigarcor.me/docs/8.x/usage/roles-and-permissions.html#checking-for-roles-permissions