Esempio n. 1
0
 /**
  * @param AccountRepositoryInterface $repository
  * @param                            $what
  *
  * @return \Illuminate\View\View
  */
 public function index(AccountRepositoryInterface $repository, $what)
 {
     $subTitle = trans('firefly.' . $what . '_accounts');
     $subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
     $types = Config::get('firefly.accountTypesByIdentifier.' . $what);
     $accounts = $repository->getAccounts($types);
     // last activity:
     /**
      * HERE WE ARE
      */
     $start = clone Session::get('start', Carbon::now()->startOfMonth());
     $start->subDay();
     $accounts->each(function (Account $account) use($start, $repository) {
         $account->lastActivityDate = $repository->getLastActivity($account);
         $account->startBalance = Steam::balance($account, $start);
         $account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
     });
     return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
 }