loadAccounts() public method

public loadAccounts ( $userId )
 /**
  * @param Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function postLoginWrapper(Request $request)
 {
     $userId = Auth::check() ? Auth::user()->id : null;
     $user = User::where('email', '=', $request->input('email'))->first();
     if ($user && $user->failed_logins >= MAX_FAILED_LOGINS) {
         Session::flash('error', trans('texts.invalid_credentials'));
         return redirect()->to('login');
     }
     $response = self::postLogin($request);
     if (Auth::check()) {
         Event::fire(new UserLoggedIn());
         $users = false;
         // we're linking a new account
         if ($request->link_accounts && $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);
     } elseif ($user) {
         $user->failed_logins = $user->failed_logins + 1;
         $user->save();
     }
     return $response;
 }
 /**
  * Handle the event.
  *
  * @param  UserLoggedIn  $event
  *
  * @return void
  */
 public function handle(UserLoggedIn $event)
 {
     $account = Auth::user()->account;
     if (empty($account->last_login)) {
         event(new UserSignedUp());
     }
     $account->last_login = Carbon::now()->toDateTimeString();
     $account->save();
     $users = $this->accountRepo->loadAccounts(Auth::user()->id);
     Session::put(SESSION_USER_ACCOUNTS, $users);
     HistoryUtils::loadHistory($users ?: Auth::user()->id);
     $account->loadLocalizationSettings();
     // if they're using Stripe make sure they're using Stripe.js
     $accountGateway = $account->getGatewayConfig(GATEWAY_STRIPE);
     if ($accountGateway && !$accountGateway->getPublishableStripeKey()) {
         Session::flash('warning', trans('texts.missing_publishable_key'));
     } elseif ($account->isLogoTooLarge()) {
         Session::flash('warning', trans('texts.logo_too_large', ['size' => $account->getLogoSize() . 'KB']));
     }
 }