Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //most simple algoritm: return rooms where there is no reservation/lecture in the requested time-period
- public function index?(requested_b_time, requested_e_time){
- $rooms = Room::join('reservation', 'room.id', '=', 'reservation.room_id')
- ->select('room.id', 'reservation.begin_time', 'reservation.end_time')
- ->whereDay('begin_time', requested_b_time->format('d')) //day equal to requested begin day
- ->whereDate('begin_time', '>=', requested_b_time) //begintime after or at the requested begintime
- ->whereDate('end_time','<=', requested_e_time); //endtime befor or at the requested endtime
- return $rooms;???
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement