1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-06-25 16:04:37 -05:00

simplified pagination, cleaned up front controller

Adding total actions count to location data has made it possible to
simplify backend data queries, so the custom pagination was optimized
and location repositories have been cleaned up.

the front end controller has been cleaned up as well, which has resulted
in the appropriate template being polished up as well.
This commit is contained in:
ro
2024-02-10 11:48:09 -06:00
parent 767f1e6a94
commit 28b002b07d
4 changed files with 36 additions and 74 deletions

View File

@ -17,33 +17,24 @@ class FrontIndexController extends Controller
public function start()
{
$list = $this->locationRepository->getRecent();
$latest_date = $list[0]->updated_at->format('Y M d');
return view('front.index', [
'count' => count($list),
'count' => count($this->locationRepository->getActiveLocations()),
'sources' => count(Source::where("active", true)->get()),
'recent' => $list,
'latest_date' => $latest_date,
'recent' => $this->locationRepository->getRecent(),
'latest_date' => $this->locationRepository->getRecent()[0]->updated_at->format('Y M d'),
'title' => "The Bad Space"
]);
}
public function indexSearch(Request $request)
{
// this grabs the search results from the db
$results = $this->locationRepository->search($request);
//this gets recent updates to display under search results
$list = $this->locationRepository->getRecent();
$latest_date = $list[0]->updated_at->format('Y M d');
return view('front.index', [
'count' => count($list),
'count' => count($this->locationRepository->getActiveLocations()),
'sources' => count(Source::where("active", true)->get()),
'recent' => $list,
'results' => $results,
'recent' => $list,
'recent' => $this->locationRepository->getRecent(),
'results' => $this->locationRepository->search($request),
'terms' => $request->index_search,
'latest_date' => $latest_date,
'latest_date' => $this->locationRepository->getRecent()[0]->updated_at->format('Y M d'),
'title' => "Search Results",
]);
}