src/AuthServiceProvider.php
/**
     * Register any authentication / authorization services.
     */
Register any authentication / authorization services.
Register any authentication / authorization services .
public function boot(): void
    {
        $models = config('nova-blog.models');
        $this->policies = [
            $models['post'] => Policies\Post::class,
            $models['comment'] => Policies\Comment::class,
            $models['category'] => Policies\Category::class,
            $models['tag'] => Policies\Tag::class,
        ];
        $this->registerPolicies();
        foreach ($this->permissions as $permission) {
            Gate::define($permission, function ($user) use ($permission) {
                if (method_exists($user, 'hasPermission')) {
                    return $user->hasPermission($permission);
                } else
                    return true;
            });
        }
    }
public function boot ( ) : void { $ models = config ( 'nova-blog.models' ) ; $ this -> policies = [ $ models [ 'post' ] => Policies \ Post :: class , $ models [ 'comment' ] => Policies \ Comment :: class , $ models [ 'category' ] => Policies \ Category :: class , $ models [ 'tag' ] => Policies \ Tag :: class , ] ; $ this -> registerPolicies ( ) ; foreach ( $ this -> permissions as $ permission ) { Gate :: define ( $ permission , function ( $ user ) use ( $ permission ) { if ( method_exists ( $ user , 'hasPermission' ) ) { return $ user -> hasPermission ( $ permission ) ; } else return true ; } ) ; } }
Register any authentication / authorization services.
Register any authentication / authorization services .