auth = $auth; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $theNext * * @return mixed */ public function handle(Request $request, Closure $theNext) { if ($this->auth->check()) { // ignore preference. set the range to be the current month: if (!Session::has('start') && !Session::has('end')) { /** @var \FireflyIII\Models\Preference $viewRange */ $viewRange = Preferences::get('viewRange', '1M'); $start = Session::has('start') ? Session::get('start') : new Carbon; $start = Navigation::updateStartDate($viewRange->data, $start); $end = Navigation::updateEndDate($viewRange->data, $start); Session::put('start', $start); Session::put('end', $end); } if (!Session::has('first')) { $journal = $this->auth->user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); if ($journal) { Session::put('first', $journal->date); } else { Session::put('first', Carbon::now()); } } // set current / next / prev month. $current = Carbon::now()->format('F Y'); $next = Carbon::now()->endOfMonth()->addDay()->format('F Y'); $prev = Carbon::now()->startOfMonth()->subDay()->format('F Y'); View::share('currentMonthName', $current); View::share('previousMonthName', $prev); View::share('nextMonthName', $next); } return $theNext($request); } }