validate($request, [ $this->username() => 'required|string|max:25', 'password' => 'required|string|min:6|max:16', 'captcha' => 'required|captcha', ]); } /** * 重写 The user has been authenticated. * * @param \Illuminate\Http\Request $request * @param mixed $user * @return mixed */ protected function authenticated(Request $request, $user) { $time = Carbon::now(); DB::table($this->usertable()) ->where('name', $user->name) ->update([ 'last_time' => $time, ]); } /** * 重写 Get the login username to be used by the controller. * * @return string */ public function username() { return 'name'; } /** * 重写 Log the user out of the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function logout(Request $request) { $this->guard()->logout(); return redirect($this->redirectToLogout()); } /** * 重写 Get the post register / login redirect path. * * @return string */ public function redirectPath() { if (method_exists($this, 'redirectTo')) { return $this->redirectTo(); } return property_exists($this, 'redirectTo') ? $this->redirectTo : '/'; } }