laravel where 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();