如何卸载 Laravel Passport [英] How to uninstall Laravel Passport

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

问题描述

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

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

我试图从 composer remove laravel/passport 开始.但是,它没有好处:

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

  [SymfonyComponentDebugExceptionFatalThrowableError]
  Class 'LaravelPassportPassport' 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?

推荐答案

您可以通过在 composer 中手动删除此行 "laravel/passport": "^4.0" 来删除护照.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 文件 LaravelPassportPassportServiceProvider::class

If you're running Laravel 5.4 or below, make sure to remove this line in your app.config file LaravelPassportPassportServiceProvider::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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆