nested relation 1

nested relation

Advert::with('Car.Model')->find(1);

Here is what the above code is Doing:
1. We’re using the with() method to eager load the Car and Model relationships.
2. We’re using the find() method to retrieve the first advert.
3. We’re using the get() method to retrieve all the adverts.

Similar Posts