public function register()
    {
        $this->getPermissions()->each(function (Permission $permission) {
            $ability = $permission->slug;
            $policy  = function ($user) use ($permission) {
                return $user->hasRole($permission->roles);
            };

            if (Str::contains($permission->slug, '@')) {
                $policy  = $permission->slug;
                $ability = $permission->name;
            }

            $this->gate->define($ability, $policy);
        });
    }
public function register()
    {
        $this->getPermissions()->each(function (Permission $permission) {
            $ability = $permission->slug;
            $policy  = function ($user) use ($permission) {
                return $user->hasRole($permission->roles);
            };

            if (Str::contains($permission->slug, '@')) {
                $policy  = $permission->slug;
                $ability = $permission->name;
            }

            $this->gate->define($ability, $policy);
        });
    }
public function register ( ) { $ this -> getPermissions ( ) -> each ( function ( Permission $ permission ) { $ ability = $ permission -> slug ; $ policy = function ( $ user ) use ( $ permission ) { return $ user -> hasRole ( $ permission -> roles ) ; } ; if ( Str :: contains ( $ permission -> slug , '@' ) ) { $ policy = $ permission -> slug ; $ ability = $ permission -> name ; } $ this -> gate -> define ( $ ability , $ policy ) ; } ) ; }
Handle permission gate registration.
Handle permission gate registration .