问题描述
我决定使用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:
-
User
模型,删除HasApiToken
特性。 -
AuthServiceProvider
,删除Passport :: routes( );
在您的启动方法中。 - 您的
config / auth.php
,将驱动程序选项更改为api
身份验证
User
model, remove theHasApiToken
trait.AuthServiceProvider
, removePassport::routes();
in your boot method.- Your
config/auth.php
, change your driver option forapi
authentication
这篇关于如何卸载Laravel Passport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!