You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In reading through the QB docs and other blog posts, I see references to using Eloquent API resources, but they are just a reference with no details. What I am trying to understand is how to use a collection for the primary model being returned, not just for a relationship inside that resource.
For instance, here is a query that returns a model called WorkHours:
and I would do stuff like converting boolean values to Yes or No in my resource.
What I can't figure out is how to use my WorkHoursResource for the returned WorkHours items. I can't wrap the whole item, since that returns all of the pagination meta data, and I've tried using WorkHoursResource at various places in the query, but no dice.
Is it even possible to use a resource for the main QueryBuilder item?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In reading through the QB docs and other blog posts, I see references to using Eloquent API resources, but they are just a reference with no details. What I am trying to understand is how to use a collection for the primary model being returned, not just for a relationship inside that resource.
For instance, here is a query that returns a model called
WorkHours
:Before implementing QueryBuilder, I was using this:
and I would do stuff like converting boolean values to
Yes
orNo
in my resource.What I can't figure out is how to use my
WorkHoursResource
for the returnedWorkHours
items. I can't wrap the whole item, since that returns all of the pagination meta data, and I've tried usingWorkHoursResource
at various places in the query, but no dice.Is it even possible to use a resource for the main QueryBuilder item?
Beta Was this translation helpful? Give feedback.
All reactions