use AppModelsUser;
$users = User::with(['posts' => function ($query) {
$query->where('title', 'like', '%code%');
}])->get();
# Select columns
Post::query()
->with(['user' => function($query) {
$query->select('id','username');
}])
->get();
$books = Book::with(['author', 'publisher'])->get();
$users = User::with('podcasts')->get();
foreach ($users->flatMap->podcasts as $podcast) {
echo $podcast->subscription->created_at;
}