I have a query with relation.
$dbQuery = $this->someModel
->where('user_id', '<>', Auth::id())
->with(['questions'])
->get(['title', 'status', 'expired_at']);
The list of fields in get()
method define the list of selected fields for the top level of selected data. But I need also add a projection to questions
relation. How can I select only questions._id
and questions.description
?
I've tried to add this to get()
list, but it not works in this way.