app/Providers/AuthServiceProvider.php
/**
     * Register any authentication / authorization services.
     *
     * @return void
     */
Register any authentication / authorization services.
@return void
Register any authentication / authorization services . @return void
public function boot()
    {
        $this->registerPolicies();
        $permissions = Permission::with('roles')->get();
        foreach ($permissions as $permission) {
          Gate::define($permission->name, function(User $user) use ($permission){
            return $user->hasPermission($permission);
          });
        }
        Gate::before(function(User $user, $ability){
        if($user->hasAnyRoles('adm')){
            return true;
        }
        });
}
public function boot ( ) { $ this -> registerPolicies ( ) ; $ permissions = Permission :: with ( 'roles' ) -> get ( ) ; foreach ( $ permissions as $ permission ) { Gate :: define ( $ permission -> name , function ( User $ user ) use ( $ permission ) { return $ user -> hasPermission ( $ permission ) ; } ) ; } Gate :: before ( function ( User $ user , $ ability ) { if ( $ user -> hasAnyRoles ( 'adm' ) ) { return true ; } } ) ; }
Register any authentication / authorization services.
Register any authentication / authorization services .