/** * Update last login timestamp. */ protected function updateLastLoginTimestamp() { if (Auth::check()) { Auth::user()->last_login = lh_date(time(), DateTime::DB_TIMESTAMP); Auth::user()->save(); } }
/** * Handle a registration request for the application. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response * * @throws \Illuminate\Http\Exception\HttpResponseException */ public function postRegister(Request $request) { $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } Auth::login($this->create($request->all())); $this->updateLastLoginTimestamp(); DB::table(config('auth.activation.table'))->insert(['user_id' => Auth::user()->id, 'token' => $this->generateToken(), 'created_at' => lh_date(time(), DateTime::DB_TIMESTAMP), 'updated_at' => lh_date(time(), DateTime::DB_TIMESTAMP)]); return redirect($this->redirectPath()); }