mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 06:23:18 +00:00
Update ApiV1Controller
This commit is contained in:
parent
1a0c1afedf
commit
ebbdb4ab96
1 changed files with 10 additions and 1 deletions
|
@ -1240,6 +1240,9 @@ class ApiV1Controller extends Controller
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
$minId = $notifications->min('id');
|
||||||
|
$maxId = $notifications->max('id');
|
||||||
|
|
||||||
$resource = new Fractal\Resource\Collection(
|
$resource = new Fractal\Resource\Collection(
|
||||||
$notifications,
|
$notifications,
|
||||||
new NotificationTransformer()
|
new NotificationTransformer()
|
||||||
|
@ -1249,7 +1252,13 @@ class ApiV1Controller extends Controller
|
||||||
->createData($resource)
|
->createData($resource)
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
return response()->json($res);
|
$baseUrl = config('app.url') . '/api/v1/notifications?';
|
||||||
|
|
||||||
|
$link = "{$baseUrl}max_id={$maxId}; rel='next',{$baseUrl}min_id={$minId};";
|
||||||
|
|
||||||
|
return response()->json($res)->withHeaders([
|
||||||
|
'Link' => $link,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue