larvel callback function 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();