jeudi 13 décembre 2018

how to use role and permission dynamically in laravel

I have tables:

users, roles & permissions.

Pivot tables:

role_user & permission_role.

Models:

User, Role and Permission.

Now what I'd like to achieve is that let's say admin adds new permission in control panel. then the bad thing is I, as a developer, have to get up, open the code and put this newly added permission in middlware of some routes by hand. each time new permission comes into play from admin, I have to add the code by hands.

Is there any way to do all that dynamically so that after admin adds new permission, i don't change anything, i don't add the code and this new permission automatically starts working?

I think this is impossible. so my question is: why do I have to let admin add roles and permissions from control panel at all? I think I should be the one who seeds this permission and roles.

Aucun commentaire:

Enregistrer un commentaire