How to query between two dates using Laravel and Eloquent?

How to query between two dates using Laravel and Eloquent?

Laravel is most popular php framework. Eloquent is a most useful feature.

Now, today's question is, How to query between two dates using Laravel and Eloquent?

The whereBetween method verifies that a column's value is between two values.

$start_from = date('2021-01-01');

$end_to = date('2021-02-02');

YourDbTableNameOrModelName::whereBetween('booking_from',[$start_from, $end_to])->get();

I hope it will be work and it's solve your problem.