Home > Back-end >  Call to undefined method Laravel\Passport\Passport::routes()
Call to undefined method Laravel\Passport\Passport::routes()

Time:10-20

I tried to use Laravel-passport so I installed this package in my project, but when i wanted to make route i wrote this code in the AuthServiceProvider

 public function boot()
    {
        $this->registerPolicies();
   
        Passport::routes();
 
    }

When i run php artisan route:list in the cmd i face with this error

  • Call to undefined method Laravel\Passport\Passport::routes()

CodePudding user response:

Since version 11 passport's routes have been moved to a dedicated route file. You can remove the Passport::routes() call from your application's service provider.

If you dont want to use default passport routes. you can disabled the route in register method inside AppServicerProvider

public function register()
{
   Passport::ignoreRoutes();
}

and you can copy the default passport routes from vendor laravel\passport\routes\web.php

for more detail about UPGRADE read this https://github.com/laravel/passport/blob/11.x/UPGRADE.md

CodePudding user response:

Remove this comment on this line on your AuthServiceProvider file.

protected $policies = [
        'App\Models\Model' => 'App\Policies\ModelPolicy',
    ];
  • Related