There are two Mysql tables:
1.reservations(id,screening_id,reserved). the reserved is a boolean its value "1".
- table seat_reserveds(id,screening_id,reservation_id,seat_id).
I want the following: 1.get the reservation id select id from reservation where screening_id = id and reserved = 1 In laravel looks like:
$reservation_id = DB::table('reservations')->select('id')- >where('screening_id',$id)->where('reserved','1')->get(); Then I want to count how many seats are reserved
Select count(id) from seat_resrveds where where screening_id = id and reservtain_id = id. In laravel looks like:
$reservedtickets = DB::table('seat_reseverds')- >where('screening_id',$id)->where('reservation_id',$reservation_id)->count('id'); I think the problam is that I get "id":number from $reservation_id so cant use it at the $reservedtitckets query because I only need a number. How can I write these querys.