適用於Laravel6及以上
$user = User::query()->where(['username' => $request->input('username')])->first();
if ($user) {
$authUser = password_verify($request->password, optional($user)->getAuthPassword()) ? $user : false;
return $user;
} else {
return $this->sendError('credentials not correct');
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結