Laravel中的routesAreCached()方法未定义
P粉304704653
P粉304704653 2023-11-08 18:45:24
0
2
366

请帮我一点忙。我正在尝试按照官方文档为我的 Laravel 应用程序设置护照。但我陷入了在调用 Passport::routes() 之前需要检查的步骤。我的 vscode 显示错误

未定义的方法:routesAreCached()

即使当我追溯到基本抽象类ServiceProvider.php时,那里的代码似乎调用 $this->app->routesAreCached() 没有任何问题。下面是我的 AppProvidersAuthServiceProvider.php 代码。

<?php

namespace AppProviders;

use IlluminateFoundationSupportProvidersAuthServiceProvider as ServiceProvider;
use IlluminateSupportFacadesGate;
use LaravelPassportPassport;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The model to policy mappings for the application.
     *
     * @var array<class-string, class-string>
     */
    protected $policies = [
        // 'AppModelsModel' => 'AppPoliciesModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        /**
         * This method will register the routes necessary to issue access tokens and revoke access tokens, clients, and personal access tokens:
         * 
         */

         if (! $this->app->routesAreCached()) {   // error at this line
            Passport::routes();
         }

    }
}


P粉304704653
P粉304704653

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!