Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bekaskaki's avatar

Query show data by date and status

db table :

 `user_id` 
  `invoice_id`
  `guest_id`
  `room_id`
  `checkin_date` 
  `checkout_date` 
  `total_price` 
  `deposit` 
  `status` //default value 0

how to query to display data by checkout_date = current date and status value 1?

i use code below but all data with 'status' values ​​0 and 1 appears :

 $guest_checkout = RoomTransaction::whereDate('checkout_date', Carbon::today())->get();

0 likes
1 reply
Tray2's avatar
Tray2
Best Answer
Level 73
$guest_checkout = RoomTransaction::whereDate('checkout_date', Carbon::today())->where('status', 1)->get();

Will get you all with status 1 as well

Please or to participate in this conversation.