public function login(Request $request)
{
if ($this->guard()->attempt(
$request->only('name', 'password'),
$request->filled('remember')
)) {
return response()->json(['Message' => '登录成功', 'Code' => 0, 'data' => Auth::user()]);
return $this->sendLoginResponse($request);
} else {
if ($this->guard()->attempt(
['email' => $request['name'], 'password' => $request['password']],
$request->filled('remenber')
)) {
return response()->json(['Message' => '登录成功', 'Code' => 0, 'data' => Auth::user()]);
return $this->sendLoginResponse($request);
} else {
return response()->json(['Message' => '登录失败', 'Code' => -1, 'data' => Auth::user()]);
}
}
}
|