Level 80
@albertopeinado You don’t need to wrap resources in JSON responses. Just return the resource. It’s literally their job.
I have no clue what could be happening here.
I have ProductCollection that returns the pagination data correctly if the data is returned from the route directly.
Route::get('/products', function () { return new ProductCollection(Product::paginate()); });
However, if the data is returned from controller as a json response like this, it does not include the pagination data:
return response()->json(new ProductCollection(Product::paginate()), 200);
Does anyone know what may be happening here?
Please or to participate in this conversation.