You can use Eloquent has()
function to query relationships even two layers deep!
1// Author -> hasMany(Book::class);2// Book -> hasMany(Rating::class);3$authors = Author::has('books.ratings')->get();
You can use Eloquent has()
function to query relationships even two layers deep!
1// Author -> hasMany(Book::class);2// Book -> hasMany(Rating::class);3$authors = Author::has('books.ratings')->get();