Table Structure
// role表
id role_id user_id
// permission表
id permission_id role_id
Now we need to based on Auth::user()->id
where role
user_id
in the table and then based on role_id
Query the permission_id
list in the permission
table. . . How to write this using eloquent
?
$permissions = User::find(1)->iwantpermissions;
one to one的类似。