Say I have a reservations
table
id - restaurant_table_id - guest_id
1 - 3 - 5
2 - 4 - 7
And then an orders
table
id - reservation_id - item_id
1 - 1 - 2
2 - 2 - 4
How can I pull orders that belong to a restaurant table?
I have tried:
$orders = ReservationOrders::with(['reservation' => function ($query) use ($restaurant_table_id) {
$query->where('restaurant_table_id', $restaurant_table_id);
}])
->get();
But the results included orders for all restaurant tables.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire