diff --git a/app/Http/Controllers/PublicController.php b/app/Http/Controllers/PublicController.php index 127304a..938fabb 100644 --- a/app/Http/Controllers/PublicController.php +++ b/app/Http/Controllers/PublicController.php @@ -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" => [