Please give me a little help. I'm trying to set up passport for my Laravel application following the official documentation. But I'm stuck on the steps I need to check before callingPassport::routes()
. My vscode shows error
Undefined method: routesAreCached()
Even when I trace back to the base abstract class ServiceProvider.php, the code there seems to call$this->app->routesAreCached()
without any issues. Below is my AppProvidersAuthServiceProvider.php code.
*/ 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(); } } }
Try this
I hope it works!
Passport's routes have been moved to a dedicated routes file. You can remove the
Passport::routes()
call from your application's service provider.This link may be helpful