【发布时间】:2018-02-20 01:16:57
【问题描述】:
我的“User”模型在“App\Models\User.php”内,当我这样做时:
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'http://localhost/oauth/token', [
'form_params' => [
'username' => $data['username'],
'password' => $data['password'],
'client_id' => env('PASSWORD_CLIENT_ID'),
'client_secret' => env('PASSWORD_CLIENT_SECRET'),
'grant_type' => 'password'
]
]);
我收到此错误:
"message": "Server error: `POST http://localhost/oauth/token` resulted in a `500 Internal Server Error` response:\nClass 'App\\User' not found\n",
似乎 Passport 正在“App”目录中寻找“User”模型,而不是正确的“Model”目录地点。
如何解决?
【问题讨论】:
-
确保将
config/auth.php中的用户模型更新为App\Model\User并运行php artisan config:cache