I have the following tables:
Customer
id
Order
id
customer_id
Order_notes
order_id
note_id
Notes
id
If I want to get all order notes for a customer so I can do the following, how can I do it? Is there way to define a relationship in my model that goes through multiple pivot tables to join a customer to order notes?
@if($customer->order_notes->count() > 0)
@foreach($customer->order_notes as $note)
// output note
@endforeach
@endif
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire