I have 3 tables
1. User table[id, name, email]
2. user_roles[user_id, role_id]
3. roles[ id, permission{post:{edit:true,delete:false}} ]
user hasone user_roles
roles belongs to user_roles
userRole.role
is eager loaded in user model
Is it possible to get the permission by calling some custom function in user model. instead of user->userRole->role
everytime. like call like $user->permissions()
will return json from roles tables
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire