This commit is contained in:
Kekskurse 2021-02-08 01:38:51 +01:00
parent 5a90fddb65
commit 958f54b9bd

View file

@ -42,12 +42,23 @@ class PublicController extends BaseController
$page = $request->input("page", 1);
$r = $g->forPage($page, 10);
$next = null;
$preview = null;
if($page > 1) {
$preview = url("/".$tenant->url.".json?page=".($page-1));
}
if($page >= ($g->count() / 10)) {
$next = url("/".$tenant->url.".json?page=".($page+1))];
}
return response()->json(["pagination" => [
"total" => $g->count(),
"items_per_page" => 10,
"pages" => ($g->count() / 10),
"preview" => url("/".$tenant->url.".json?page=".($page-1)),
"next" => url("/".$tenant->url.".json?page=".($page+1))],
"preview" => $preview,
"next" => $next,
"data" => \App\Http\Resources\Gallery::collection($r)]);
}
public function listGalleriesView($name, Request $request) {