src/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();
        Gate::before(function ($user) {
            return $user->hasAllAccess();
        });
        Gate::define('is_admin', function ($user = null) {
            return $user->type === UserTypeEnum::admin();
        });
        Passport::routes();
        Passport::tokensCan([
            'create' => 'Create resources',
            'read' => 'Read Resources',
            'update' => 'Update Resources',
            'delete' => 'Delete Resources',
        ]);
        Passport::setDefaultScope([
            'read',
        ]);
    }
public function boot ( ) { $ this -> registerPolicies ( ) ; Gate :: before ( function ( $ user ) { return $ user -> hasAllAccess ( ) ; } ) ; Gate :: define ( 'is_admin' , function ( $ user = null ) { return $ user -> type === UserTypeEnum :: admin ( ) ; } ) ; Passport :: routes ( ) ; Passport :: tokensCan ( [ 'create' => 'Create resources' , 'read' => 'Read Resources' , 'update' => 'Update Resources' , 'delete' => 'Delete Resources' , ] ) ; Passport :: setDefaultScope ( [ 'read' , ] ) ; }
Register any authentication / authorization services.
Register any authentication / authorization services .
// Implicitly grant "Admin" role all permissions // This works in the app by using gate-related functions like auth()->user->can() and @can() // 'create', // 'update', // 'delete',