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();
}

My one more url has same issue. Buy no body still respon

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.