laravel acl from medium

Solutions on MaxInterview for laravel acl from medium by the best coders in the world

showing results for - "laravel acl from medium"
Justine
03 Sep 2017
1class User extends Authenticatable
2{
3    // ...
4 
5    public function isAuthorized($object, $operation)
6    {
7        return Db::table('role_permissions')
8            ->where('object', $object)
9            ->where('operation', $operation)
10            ->join('user_roles', 'user_roles.role_id', '=', 'role_permissions.role_id')
11            ->where('user_roles.user_id', $this->id)
12            ->exists();
13    }
14}
15