$users = User::with(array('posts' => function($query)
{
$query->where('title', 'like', '%first%');
}))->get();
kticka said:
$users = User::with(array('posts' => function($query) { $query->where('title', 'like', '%first%'); }))->get();
Thanks, it initially didn't occur to me that I could add additional where() conditions outside the with() when I first saw this but doing so seems to work.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community