in my Laravel application I created this resource collection using artisan and leave as default:
class QuestionResourceCollection extends ResourceCollection
{
public function toArray($request)
{
return parent::toArray($request);
}
}
in my controller I'm using the index function to retrieve data from the database and then paginate it using cursor pagination like so:
public function index()
{
return new QuestionResourceCollection(Question::query()
->with('user')->cursorPaginate(10));
the response returned from this contains the links and meta attribute but the meta object does not include the "total" attribute as shown in the docs here
what am I doing wrong?
source https://stackoverflow.com/questions/75952130/laravel-resource-not-showing-total-attribute-inside-meta-when-returned-as-js
No comments:
Post a Comment