本文介绍了如何卸载Laravel Passport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定使用JWT并从项目中完全删除Laravel Passport。

I've decided to use JWT and completely remove Laravel Passport from the project.

我试图从 composer开始,删除laravel /护照。但是,这样做没有好处:

I was trying to start with composer remove laravel/passport. However, it does no good:

  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'Laravel\Passport\Passport' not found


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Removal failed, reverting ./composer.json to its original content.

什么是正确且安全的清除程序?

What could be the right and safe removing procedure?

推荐答案

您可以通过手动删除 laravel / passport: ^ 4.0 这一行来删除护照c $ c> composer.json 文件,然后运行 composer update

You can remove passport by manually deleting this line "laravel/passport": "^4.0" in your composer.json file then run composer update.

如果正在运行Laravel 5.4或更低版本,请确保在您的 app.config 文件 Laravel\Passport\PassportServiceProvider :: class

If you're running Laravel 5.4 or below, make sure to remove this line in your app.config file Laravel\Passport\PassportServiceProvider::class

所有依赖护照的类别也必须进行编辑。最常见的类是:

And all classes that relies on passport must be edited as well. The most common classes are:


  1. User 模型,删除 HasApiToken 特性。

  2. AuthServiceProvider ,删除 Passport :: routes( ); 在您的启动方法中。

  3. 您的 config / auth.php ,将驱动程序选项更改为 api 身份验证

  1. User model, remove the HasApiToken trait.
  2. AuthServiceProvider, remove Passport::routes(); in your boot method.
  3. Your config/auth.php, change your driver option for api authentication

这篇关于如何卸载Laravel Passport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 05:53