laravel eloquent withHas() callback code example
Example: laravel with callback
$users = User::with(['posts' => function($query)
{
$query->orderBy('created_at', 'desc');
}])->get();
$users = User::with(['posts' => function($query)
{
$query->orderBy('created_at', 'desc');
}])->get();