We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am struggling to work out how you would return data when using the paginator.
For example I am doing this
$data = $this->some_repo->callPaginator(); $foo = $data->getCollection(); $resource = new Collection($foo, new FooTransformer); $resource->setPaginator(new IlluminatePaginatorAdapter($data));
If I was to try and $resource->setPaginator(new IlluminatePaginatorAdapter($data)); I get the following error:
$resource->setPaginator(new IlluminatePaginatorAdapter($data));
The Response content must be a string or object implementing __toString(), "object" given.
So what is the correct way to return data from a paginator?
Thanks
The text was updated successfully, but these errors were encountered:
This was taken care of over email.
Sorry, something went wrong.
Hi Phil, for everyone else (myself included) what is the correct way to do this?
I just shove this into an abstract repository that the others extend:
/** * Retrieve all entities * * @param array $with * * @return \Illuminate\Database\Eloquent\Collection */ public function getAll(array $with = array()) { return $this->make($with)->get(); } /** * Retrieve paginated entities * * @param array $with * * @return \Illuminate\Pagination\Paginator */ public function getPaginated(array $with = array()) { return $this->make($with)->paginate(); }
No branches or pull requests
I am struggling to work out how you would return data when using the paginator.
For example I am doing this
If I was to try and
$resource->setPaginator(new IlluminatePaginatorAdapter($data));
I get the following error:So what is the correct way to return data from a paginator?
Thanks
The text was updated successfully, but these errors were encountered: