I have 3 tables name like "product" , "user", "product_type" so in my case user and account_type having many to many relationship and user and product having one to many relationship and product and product_type having one to one relationship.
I create one pivot table for user and product_type. inside that pivot table, I added one more column for description. so in product listing page I need to display description from that pivot table.
My code look like this:
Product::with('user)->with('product_type')->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire