Use limit with eager loading?

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){

You forget the “[” and “]”: which are used into PHP

Thank you for this information