This is my Query eloquent created, i need to get materials that are available in dates.
I have guided from here: Room Booking Query
How to fix these errors?
Material::with(['orders_material' => function($query) use ($begin_date,
$end_date, $begin_hour, $hour_final)
{
$query->whereNotIn(
$query->where('date_begin', '>=', $begin_date)
->where('date_begin', '<=', $end_date)
->where('date_final', '>=', $begin_date)
->where('date_final', '<=', $end_date)
->where('hour_begin', '>=', $begin_hour)
->where('hour_begin', '<=', $hour_final)
->where('hour_final', '>=', $begin_hour)
->where('hour_final', '<=', $hour_final);
//->wherePivot('Material_id', null)
//->wherePivot('Orders_id', null)
);
}
The syntax is not correct, what syntax I can use?