这算什么操作?
// if (!Auth::attempt(['mobile' => $data['mobile'], 'password' => $data['password']])) {
// return $this->renderError('认证错误');
// }
// $user = $request->user();
$user = User::where(['mobile' => $data['mobile'], 'password' => $data['password'], 'shop_id' => $data['shop_id']])->first();
if (is_null($user)) return $this->renderError('用户不存在');
$tokenResult = $user->createToken('Personal Access Token');
$token = $tokenResult->token;
if ($data['remember_me']) {
$token->expires_at = Carbon::now()->addWeeks();
}
$token->save();
看到上面这样的代码(passport认证的login()),
attempt
被注掉。了解到这样做的原因是为了实现相同手机号注册的不同用户认证…
?????????????????????????????????
推荐文章: