尝试在终端上执行$ php artisanpassport:install时收到错误,我将在下面粘贴:
In AuthServiceProvider.php line 26:
Class 'App\Providers\Passport' not found
我怀疑问题出在我的config / auth.php中,所以我将链接下面的内容(删除评论):
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];
下面是我提到过Laravel Passport的其他文件...
App / user.php:
<?php
namespace App;
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User 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 App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
Passport::routes();
$this->registerPolicies();
//
}
}
关于如何解决此问题的任何想法?
答案 0 :(得分:1)
似乎您需要添加Passport
:
use Laravel\Passport\Passport;
答案 1 :(得分:0)
您需要致电上课。 "AuthServiceProvider.php"
添加到文件顶部;
use Laravel\Passport\Passport;
或
use App\Providers\Passport;