auth = $auth; $this->registrar = $registrar; $this->accountRepo = $repo; //$this->middleware('guest', ['except' => 'getLogout']); } public function getLoginWrapper() { if (!Utils::isNinja() && !User::count()) { return redirect()->to('invoice_now'); } return self::getLogin(); } public function postLoginWrapper(Request $request) { $userId = Auth::check() ? Auth::user()->id : null; $response = self::postLogin($request); if (Auth::check()) { Event::fire(new UserLoggedIn()); if (Utils::isPro()) { $users = false; // we're linking a new account if ($userId && Auth::user()->id != $userId) { $users = $this->accountRepo->associateAccounts($userId, Auth::user()->id); Session::flash('message', trans('texts.associated_accounts')); // check if other accounts are linked } else { $users = $this->accountRepo->loadAccounts(Auth::user()->id); } Session::put(SESSION_USER_ACCOUNTS, $users); } } return $response; } public function getLogoutWrapper() { $response = self::getLogout(); Session::flush(); return $response; } }