This commit is contained in:
Kekskurse 2021-02-08 11:10:05 +01:00
parent e13aba460f
commit 59fed4d0a4

View file

@ -37,10 +37,10 @@ class PublicController extends BaseController
foreach ($galleries as $gallery) {
$gallery->html = $parser->parse($gallery->description);
}
$limit = $request->input("limit", 10);
$g = collect($galleries);
$page = $request->input("page", 1);
$r = $g->forPage($page, 10);
$r = $g->forPage($page, $limit);
$next = null;
$preview = null;
@ -49,14 +49,14 @@ class PublicController extends BaseController
$preview = url("/".$tenant->url.".json?page=".($page-1));
}
if(($g->count() / 10) > $page) {
if(($g->count() / $limit) > $page) {
$next = url("/".$tenant->url.".json?page=".($page+1));
}
return response()->json(["pagination" => [
"total" => $g->count(),
"items_per_page" => 10,
"pages" => ($g->count() / 10),
"items_per_page" => $limit,
"pages" => ($g->count() / $limit),
"preview" => $preview,
"next" => $next],
"data" => [