get('start')); $end = new Carbon($request->get('end')); $label = $request->get('label'); $isCustomRange = false; Log::debug('Received dateRange', ['start' => $request->get('start'), 'end' => $request->get('end'), 'label' => $request->get('label')]); // check if the label is "everything" or "Custom range" which will betray // a possible problem with the budgets. if ($label === strval(trans('firefly.everything')) || $label === strval(trans('firefly.customRange'))) { $isCustomRange = true; Log::debug('Range is now marked as "custom".'); } $diff = $start->diffInDays($end); if ($diff > 50) { Session::flash('warning', strval(trans('firefly.warning_much_data', ['days' => $diff]))); } Session::put('is_custom_range', $isCustomRange); Session::put('start', $start); Session::put('end', $end); } /** * @throws FireflyException */ public function displayError() { Log::debug('This is a test message at the DEBUG level.'); Log::info('This is a test message at the INFO level.'); Log::notice('This is a test message at the NOTICE level.'); Log::warning('This is a test message at the WARNING level.'); Log::error('This is a test message at the ERROR level.'); Log::critical('This is a test message at the CRITICAL level.'); Log::alert('This is a test message at the ALERT level.'); Log::emergency('This is a test message at the EMERGENCY level.'); throw new FireflyException('A very simple test error.'); } /** * @param Request $request * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function flush(Request $request) { Preferences::mark(); $request->session()->forget(['start', 'end', '_previous', 'viewRange', 'range', 'is_custom_range']); Artisan::call('cache:clear'); return redirect(route('index')); } /** * @param AccountRepositoryInterface $repository * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View */ public function index(AccountRepositoryInterface $repository) { $types = config('firefly.accountTypesByIdentifier.asset'); $count = $repository->count($types); if ($count === 0) { return redirect(route('new-user.index')); } $subTitle = trans('firefly.welcomeBack'); $transactions = []; $frontPage = Preferences::get( 'frontPageAccounts', $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray() ); /** @var Carbon $start */ $start = session('start', Carbon::now()->startOfMonth()); /** @var Carbon $end */ $end = session('end', Carbon::now()->endOfMonth()); $accounts = $repository->getAccountsById($frontPage->data); $showDeps = Preferences::get('showDepositsFrontpage', false)->data; // zero bills? Hide some elements from view. /** @var BillRepositoryInterface $billRepository */ $billRepository = app(BillRepositoryInterface::class); $billCount = $billRepository->getBills()->count(); foreach ($accounts as $account) { $collector = app(JournalCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit(10)->setPage(1); $set = $collector->getJournals(); $transactions[] = [$set, $account]; } return view( 'index', compact('count', 'subTitle', 'transactions', 'showDeps','billCount') ); } public function routes() { $set = RouteFacade::getRoutes(); $ignore = ['chart.', 'javascript.', 'json.', 'report-data.', 'popup.', 'debugbar.', 'attachments.download', 'attachments.preview', 'bills.rescan', 'budgets.income', 'currencies.def', 'error', 'flush', 'help.show', 'import.file', 'login', 'logout', 'password.reset', 'profile.confirm-email-change', 'profile.undo-email-change', 'register', 'report.options', 'routes', 'rule-groups.down', 'rule-groups.up', 'rules.up', 'rules.down', 'rules.select', 'search.search', 'test-flash', 'transactions.link.delete', 'transactions.link.switch', 'two-factor.lost', 'report.options', ]; /** @var Route $route */ foreach ($set as $route) { $name = $route->getName(); if (!is_null($name) && in_array('GET', $route->methods()) && strlen($name) > 0) { $found = false; foreach ($ignore as $string) { if (strpos($name, $string) !== false) { $found = true; } } if (!$found) { echo 'touch ' . $route->getName() . '.md;'; } } } return ' '; } /** * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function testFlash() { Session::flash('success', 'This is a success message.'); Session::flash('info', 'This is an info message.'); Session::flash('warning', 'This is a warning.'); Session::flash('error', 'This is an error!'); return redirect(route('home')); } }