Skip to content

Instantly share code, notes, and snippets.

@mehranhadidi
Created August 23, 2016 05:11
Show Gist options
  • Save mehranhadidi/121657d213d97ea77bf3c93a852de205 to your computer and use it in GitHub Desktop.
Save mehranhadidi/121657d213d97ea77bf3c93a852de205 to your computer and use it in GitHub Desktop.
// eager load in laravel new way
$post = Post::find(1);
$post->load('comments.owner'); // will load the post + comments (relationship) + owner (relationship)
return $post;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment