relations eager loading
ccerrillo opened this issue · comments
Hi,
It's possible in this case to eager load the post relation along with the deepComments?
class Country extends Model
{
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
public function deepComments()
{
return $this->hasManyDeepFromRelations($this->posts(), (new Post())->comments());
}
public function posts()
{
return $this->hasManyThrough(Post::class, User::class);
}
}
class Post extends Model
{
public function comments()
{
return $this->hasMany(Comment::class);
}
}
Hi @ccerrillo,
How do you mean "along"? Do you mean posts with their comments?
I'm sorry, I was using a test database and didn't have the relationship in the table... just a simple 'with("posts")' was enough