-
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
Before implementing QueryBuilder, I was using this:
and I would do stuff like converting boolean values to What I can't figure out is how to use my Is it even possible to use a resource for the main QueryBuilder item? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I'm not sure, if you still need help with this, but will give a try. Overall, it is stupid simple to incorporate both, as the QueryBuilder is doing nothing more than creating the query. So you can just take the query build from QueryBuilder, execute it and give the result to your Eloquent API Resource / Collection.
|
Beta Was this translation helpful? Give feedback.
-
Yes, I have figured it out since then. Thanks. |
Beta Was this translation helpful? Give feedback.
I'm not sure, if you still need help with this, but will give a try. Overall, it is stupid simple to incorporate both, as the QueryBuilder is doing nothing more than creating the query. So you can just take the query build from QueryBuilder, execute it and give the result to your Eloquent API Resource / Collection.