add a get() to it, then you have the entire booking, you can then access the id or anything else you need,
Bear in mind that this will return a collection, so you could have multiple entries all with the same timeslot
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello! I am trying to find the "id" of booking for a particular time, this is what I have at the moment:
Booking::where('timeslot', '=', $reservation->reservation_time);
Is there a method to chain to get "id"? Thanks in advance!
@prokosa can be shortened to
$items=Booking::where('timeslot', '=', $reservation->reservation_time)->get()->modelKeys();
Please or to participate in this conversation.