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();
        Passport::routes();
        Route::group(['middleware' => 'oauth.providers'], function () {
            Passport::routes(function ($router) {
                return $router->forAccessTokens();
            });
        });
        Gate::before(function ($user, $ability) {
            return $user->hasRole('Super Admin') ? true : null;
        });
    }
public function boot ( ) { $ this -> registerPolicies ( ) ; Passport :: routes ( ) ; Route :: group ( [ 'middleware' => 'oauth.providers' ] , function ( ) { Passport :: routes ( function ( $ router ) { return $ router -> forAccessTokens ( ) ; } ) ; } ) ; Gate :: before ( function ( $ user , $ ability ) { return $ user -> hasRole ( 'Super Admin' ) ? true : null ; } ) ; }
Register any authentication / authorization services.
Register any authentication / authorization services .
// Middleware `oauth.providers` middleware defined on $routeMiddleware above // Implicitly grant "Super Admin" role all permissions // This works in the app by using gate-related functions like auth()->user->can() and @can()