From 3df8751306af24139e5f24623192b1af5ab2e974 Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Mon, 8 Feb 2021 01:27:06 +0100 Subject: [PATCH] Stuff --- app/Http/Controllers/PublicController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php index e55f4df..89cfc4d 100644 --- a/app/Http/Controllers/PublicController.php +++ b/app/Http/Controllers/PublicController.php @@ -39,9 +39,15 @@ class PublicController extends BaseController } $g = collect($galleries); - $r = $g->forPage($request->input("page", 1), 10); + $page = $request->input("page", 1) + $r = $g->forPage($page, 10); - return response()->json(["pagination" => ["total" => $g->count(), "items_per_page" => 10, "pages" => ($g->count() / 10)], "data" => \App\Http\Resources\Gallery::collection($r)]); + return response()->json(["pagination" => [ + "total" => $g->count(), + "items_per_page" => 10, + "pages" => ($g->count() / 10)], + "next" => url("/".$tenant->url.".json?page=".($page+1)), + "data" => \App\Http\Resources\Gallery::collection($r)]); } public function listGalleriesView($name, Request $request) { $tenant = Tenant::query()->where("url", "=", $name)->firstOrFail();