auth = $auth; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $theNext * * @return mixed */ public function handle($request, Closure $theNext) { if ($this->auth->check()) { // user's view range comes from preferences, gets set in session: /** @var \FireflyIII\Models\Preference $viewRange */ $viewRange = Preferences::get('viewRange', '1M'); // the start and end date are checked and stored: $start = Session::has('start') ? Session::get('start') : new Carbon; $start = Navigation::updateStartDate($viewRange->data, $start); $end = Navigation::updateEndDate($viewRange->data, $start); $period = Navigation::periodName($viewRange->data, $start); $prev = Navigation::jumpToPrevious($viewRange->data, clone $start); $next = Navigation::jumpToNext($viewRange->data, clone $start); Session::put('range', $viewRange->data); Session::put('start', $start); Session::put('end', $end); Session::put('period', $period); Session::put('prev', Navigation::periodName($viewRange->data, $prev)); Session::put('next', Navigation::periodName($viewRange->data, $next)); } return $theNext($request); } }