LMSouq
database Open

How to query between two dates using Laravel and Eloquent?

WO
wobsoriano
1 month ago
4 views
Problem Description
I'm trying to create a report page that shows reports from a specific date to a specific date. Here's my current code: $now = date('Y-m-d'); $reservations = Reservation::where('reservation_from', $now)->get(); What this does in plain SQL is `select * from table where reservation_from = $now`. I have this query here but I don't know how to convert it to eloquent query. SELECT * FROM table WHERE reservation_from BETWEEN '$from' AND '$to How can I convert the code above to eloquent query?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base