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();
        Schema::defaultStringLength(191);
        Gate::define('add-category', function ($user) {
            $check = 0;
            foreach($user->roles as $role){
                if($role->role_name == 'admin'){
                    $check++;
                }
            }
            return $check > 0
                        ? Response::allow()
                        : Response::deny('You must be a  administrator.');
        });
    }
public function boot ( ) { $ this -> registerPolicies ( ) ; Schema :: defaultStringLength ( 191 ) ; Gate :: define ( 'add-category' , function ( $ user ) { $ check = 0 ; foreach ( $ user -> roles as $ role ) { if ( $ role -> role_name == 'admin' ) { $ check ++ ; } } return $ check > 0 ? Response :: allow ( ) : Response :: deny ( 'You must be a  administrator.' ) ; } ) ; }
Register any authentication / authorization services.
Register any authentication / authorization services .