我在尝试执行$ php工匠护照:安装在我的终端上时收到错误,我将粘贴在下面:
In AuthServiceProvider.php line 26:
Class 'AppProvidersPassport' not found
我怀疑问题出在我的配置/身份验证中.php ,所以我将链接以下内容(删除评论):
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => AppUser::class,
],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];
以下是我提到的拉拉维尔护照的其他文件......
应用/用户.php :
<?php
namespace App;
use LaravelPassportHasApiTokens;
use IlluminateNotificationsNotifiable;
use IlluminateFoundationAuthUser as Authenticatable;
class User extends Authenticatable
{
use HasApiTokens, Notifiable;
protected $fillable = ['name', 'email', 'password', 'chatkit_id'];
protected $hidden = ['password', 'remember_token'];
public function setPasswordAttribute($value)
{
$this->attributes['password'] = bcrypt($value);
}
}
app/providers/AuthServiceProvider.php :
<?php
namespace AppProviders;
use IlluminateSupportFacadesGate;
use IlluminateFoundationSupportProvidersAuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'AppModel' => 'AppPoliciesModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
Passport::routes();
$this->registerPolicies();
//
}
}
关于如何解决这个问题的任何想法?
似乎您需要添加Passport
:
use LaravelPassportPassport;
你需要打电话给类。 "AuthServiceProvider.php"
添加到文件顶部;
use LaravelPassportPassport;
或
use AppProvidersPassport;