validatePhrase( (string) $request->input('captcha_key'), (string) $request->input('captcha_phrase') ); $user = User::where('phone', $request->input('phone'))->first(); if (! $user?->verifyPassword($request->input('password'))) { throw new BizException(__('Incorrect account or password')); } $user->update([ 'last_login_at' => now(), 'last_login_ip' => $request->realIp(), ]); $user->tokens()->delete(); return response()->json( $user->createDeviceToken(Device::UNIAPP) ); } }