laravel how to define a relation code example
Example: laravel relation of relation
//Multiple relationships:
$books = Book::with('author', 'publisher')->get();
//Nested relationships:
$books = Book::with('author.contacts')->get();
//Multiple relationships:
$books = Book::with('author', 'publisher')->get();
//Nested relationships:
$books = Book::with('author.contacts')->get();