middleware('guest')->except('logout'); $this->username = $this->findUsername(); } /** * Get the login username to be used by the controller. * * @return string */ public function findUsername() { $login = request()->input('login'); $fieldType = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'name'; request()->merge([$fieldType => $login]); return $fieldType; } /** * Get username property. * * @return string */ public function username() { return $this->username; } }