Stuff
This commit is contained in:
parent
5a90fddb65
commit
958f54b9bd
1 changed files with 13 additions and 2 deletions
|
@ -42,12 +42,23 @@ class PublicController extends BaseController
|
||||||
$page = $request->input("page", 1);
|
$page = $request->input("page", 1);
|
||||||
$r = $g->forPage($page, 10);
|
$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" => [
|
return response()->json(["pagination" => [
|
||||||
"total" => $g->count(),
|
"total" => $g->count(),
|
||||||
"items_per_page" => 10,
|
"items_per_page" => 10,
|
||||||
"pages" => ($g->count() / 10),
|
"pages" => ($g->count() / 10),
|
||||||
"preview" => url("/".$tenant->url.".json?page=".($page-1)),
|
"preview" => $preview,
|
||||||
"next" => url("/".$tenant->url.".json?page=".($page+1))],
|
"next" => $next,
|
||||||
"data" => \App\Http\Resources\Gallery::collection($r)]);
|
"data" => \App\Http\Resources\Gallery::collection($r)]);
|
||||||
}
|
}
|
||||||
public function listGalleriesView($name, Request $request) {
|
public function listGalleriesView($name, Request $request) {
|
||||||
|
|
Loading…
Reference in a new issue