Some code cleanup and reordering

This commit is contained in:
James Cole
2016-01-24 15:58:16 +01:00
parent 2832d308f1
commit 97db618cd8
10 changed files with 453 additions and 458 deletions

View File

@@ -144,33 +144,6 @@ class CategoryController extends Controller
return view('categories.noCategory', compact('list', 'subTitle'));
}
/**
* @param SCRI $repository
* @param Category $category
*
* @param $date
*
* @return \Illuminate\View\View
*/
public function showWithDate(SCRI $repository, Category $category, $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'));
$set = $repository->getJournalsInRange($category, $page, $start, $end);
$count = $repository->countJournalsInRange($category, $start, $end);
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals->setPath('categories/show/' . $category->id . '/' . $date);
return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle', 'carbon'));
}
/**
* @param SCRI $repository
* @param Category $category
@@ -232,6 +205,33 @@ class CategoryController extends Controller
return view('categories.show', compact('category', 'journals', 'entries', 'hideCategory', 'subTitle'));
}
/**
* @param SCRI $repository
* @param Category $category
*
* @param $date
*
* @return \Illuminate\View\View
*/
public function showWithDate(SCRI $repository, Category $category, $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'));
$set = $repository->getJournalsInRange($category, $page, $start, $end);
$count = $repository->countJournalsInRange($category, $start, $end);
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals->setPath('categories/show/' . $category->id . '/' . $date);
return view('categories.show_with_date', compact('category', 'journals', 'hideCategory', 'subTitle', 'carbon'));
}
/**
* @param CategoryFormRequest $request
* @param SCRI $repository