How to use laravel wherebetween together

Using Laravel whereBetween is tricky in some cases. Normally laravel wherebetween takes two arguments to check. Let’s check how to do that.

Just simply use-

$reservations = Reservation::whereBetween('reservation_from', [$from, $to])->get();

Now imagine that you need to use more condition on that.

$reservations = Reservation::whereBetween('reservation_from', [$from_from, $to_from])
->orWhereBetween('reservation_to', [$from_to, $to_to])
->get();

Hope it will work.