I have a website in laravel instazood I want to apply limit clause with eager loading. I tried many other ways made r and d but could not get any solution.
function fetchData() {
$user = new User;
$data = $user->with('comments'=>function($query){
$query->where('status',5);
$query->limit(1);
})->get();
}