/** * @param CRI $repository * @param Category $category * * @param $date * * @return View */ public function showWithDate(CRI $repository, Category $category, string $date) { $carbon = new Carbon($date); $range = Preferences::get('viewRange', '1M')->data; $start = Navigation::startOfPeriod($carbon, $range); $end = Navigation::endOfPeriod($carbon, $range); $subTitle = $category->name; $hideCategory = true; // used in list. $page = intval(Input::get('page')); $pageSize = Preferences::get('transactionPageSize', 50)->data; $offset = ($page - 1) * $pageSize; $set = $repository->journalsInPeriod(new Collection([$category]), new Collection(), [], $start, $end); $count = $set->count(); $subSet = $set->splice($offset, $pageSize); $journals = new LengthAwarePaginator($subSet, $count, $pageSize, $page); $journals->setPath('categories/show/' . $category->id . '/' . $date); return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle', 'carbon')); }