Есть контроллер
public function index(): ArticleCollection
{
$articles = Article::orderByDesc('id')->paginate(24);
return new ArticleCollection($articles);
}
и resource
class ArticleCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'data' => $this->collection,
];
}
}
как мне спрятать при отдаче на фронт
массив
"links": {
"first": "http://site.test/api/v1/admin/articles?page=1",
"last": "http://site.test/api/v1/admin/articles?page=1",
"prev": null,
"next": null
},
и из meta убрать links
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "http://site.test/api/v1/admin/articles?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "http://site.test/api/v1/admin/articles",
"per_page": 24,
"to": 1,
"total": 1
}