mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update BaseApiController
This commit is contained in:
parent
ec18c80c13
commit
5ef7936b48
1 changed files with 1 additions and 4 deletions
|
@ -59,14 +59,11 @@ class BaseApiController extends Controller
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
} else {
|
} else {
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'page' => 'nullable|integer|min:1',
|
'page' => 'nullable|integer|min:1|max:10',
|
||||||
'limit' => 'nullable|integer|min:1|max:10'
|
'limit' => 'nullable|integer|min:1|max:10'
|
||||||
]);
|
]);
|
||||||
$limit = $request->input('limit') ?? 10;
|
$limit = $request->input('limit') ?? 10;
|
||||||
$page = $request->input('page') ?? 1;
|
$page = $request->input('page') ?? 1;
|
||||||
if($page > 3) {
|
|
||||||
return response()->json([]);
|
|
||||||
}
|
|
||||||
$end = (int) $page * $limit;
|
$end = (int) $page * $limit;
|
||||||
$start = (int) $end - $limit;
|
$start = (int) $end - $limit;
|
||||||
$res = NotificationService::get($pid, $start, $end);
|
$res = NotificationService::get($pid, $start, $end);
|
||||||
|
|
Loading…
Reference in a new issue