Please rephrase your question and explain what you want to do and what is happening, and share what error message you are receiving
Feb 2, 2020
3
Level 2
query
$status_id = BookStatus::where('name', 'Booked')->firstOrFail()->id;
$check_in =$check['check_in'];
$check_out=$check['check_out'];
$booking_id=$room->bookings()->with('individualRooms')->get();
$booking_list=$booking_id->pluck('individual_rooms');
$roomNeverBooking =$room->individualRooms()->whereNotIn('id',$booking_list)->get()->pluck('id','room_no');
$roomNotReserve = $room->bookings()->with('individualRooms')->whereNotIn('bookings.book_status_id',[$status_id])
->when(request(['check_in','check_out']), function($q){
return $q->where('bookings.check_out','=<', request('check_in'))
->orWhere('bookings.check_in','>=',request('check_out'));
})->with('individualRooms')->get()->pluck('id','room_no');
$result=$roomNeverBooking->merge($roomNotReserve);
change this one line query how??????????
$roomNotReserve =$room->individualRooms()->whereNotIn('id',$booking_list)
->where(function ($query,$status_id){
$query->with('individualRooms')->whereNotIn('bookings.book_status_id',[$status_id])
->when(request(['check_in','check_out']), function($q){
return $q->where('bookings.check_out','=<', request('check_in'))
->orWhere('bookings.check_in','>=',request('check_out'));
});
})->get()->pluck('id','room_no');
dd($roomNotReserve);// error
edit the second query to give me the 1st output. :)
Please or to participate in this conversation.