Access 2nd and 3rd table from 1st table model laraval eloquent [duplicate]

  eloquent, laravel

I have 4 table lets say deals,deal products,products,and cart item.
I can access all my deals with products like


And also i can access products with cart item like

Product::with('cart item')->get()

My question is how can i access Deals with products and cart item

Note :: Deal has relationship with only deals product and products . Product has relationship with cart item (for now)

How can i get Deals with products and cart_item
Do i need to define a new relationship ?
I need the logic for getting this data

I am sorry if my question make any sense hope anyone can help me with this information

Source: Laravel

Leave a Reply