How to eager load multiple levels of relationships in Eloquent?
October 26, 2018
You can use the 'dot notation' to eager load multiple levels of relationships in Eloquent
<?php
$posts = Posts::with("comments.author")->get();
This will load the comments relationship, and load the authors for each comment. Of course this assumes that you have set up the relationships correctly in your models