Leverage injected request object

Laravel automatically injects the current Http [request object][1] to all Controller actions and Middleware. Leveraging this object improves consistency and testability.

[1]: https://laravel.com/docs/requests#accessing-the-request
This commit is contained in:
Shift
2023-03-30 14:15:14 +00:00
parent ce9ce47010
commit 66c246852c
16 changed files with 82 additions and 79 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ class GamesController extends BasePageController
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
$ordering = $games->getGamesOrdering();
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
$rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata->categoryexclusions);
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());