use Eloquent ApiResource #753
Unanswered
RobertBouten
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using Laravel's ApiResources in my project and just started using spatie laravel query builder.
Instead of my standard model defined in the toArray() function of my Race model I would like to use an alternative model as defined in my RaceResource.
So instead of
$users = QueryBuilder::for(User::class)
->allowedFilters('name')
->get()
I woud like to do something like
$users = QueryBuilder::for(UserResource::class)
->allowedFilters('name')
->get()
But this doesn't seem to work.
Thanks for any guidance on how to use api resources together with spatie laravel query builder.
Beta Was this translation helpful? Give feedback.
All reactions