How would I do this query in Laravel? I think I'm getting in a right tangle.
select * from `entries`
where (`id` = (
select entry_id FROM `elements` where `content` = 'David'
));
I have an Entry model and an Element model, and eager loading works fine (i.e. if I instead did $entries = Entry::with('elements'); it works great).
I'd like to grab the entries where the elements related element's have a certain value.
My attempt grabs all the Entries, but only the elements where the query fits:
$entries = Entry::with(['elements' => function($q) use ($find){
$q->where('content', '=', $find);
}])->get();