Answers for "laravel acl from medium"

PHP
0

laravel acl from medium

class User extends Authenticatable
{
    // ...
 
    public function isAuthorized($object, $operation)
    {
        return Db::table('role_permissions')
            ->where('object', $object)
            ->where('operation', $operation)
            ->join('user_roles', 'user_roles.role_id', '=', 'role_permissions.role_id')
            ->where('user_roles.user_id', $this->id)
            ->exists();
    }
}
Posted by: Guest on September-09-2020

Browse Popular Code Answers by Language