Level 55
Room::whereNotIn('id')
missing second attribute.
What's the problem to just combine 2 previous queries?
$data = Room::whereNotIn('id', function($query) use($request) {
$query->select('room_id')
->from('locks')
->where('created_at', '>', Carbon::now()->subMinutes(15));
})
->whereNotIn('id', function($query) use($request) {
$query->select('room_id')
->from('bookings')
->where ('checkout_date', '>=', $request->checkin_date)
->where('checkin_date', '<=', $request->checkout_date);
})
->get();
1 like