This package is made for exactly that purpose and is very well documented.
(*without any package*) Simplest way to add Permissions Roles in a Laravel Project
I'm working on a simple project. A user having one role and a role having multiple permissions. Role and permission table is having a many to many relationship and i created a pivot table to store role_id and permission_id then how to restrict a specific user according to his role which has been assigned some permission.
So, can you suggest to how can i implement User Access Management kinda stuff in the easiest way possible. PS:- without using any packages like Spatie,etc
And permission table only includes two columns id and name
Ok fair enough with the no package rule. Simply use policies and guards.
Look at this example https://laravel.com/docs/6.x/authorization#supplying-additional-context
$this->authorize('update', [$post, 'permission_name']);
You pass the name of the permission to check and then in the policy you check if the user has a role with that permission.
Does that make sense?
Please or to participate in this conversation.