If you're querying a month at a time, and you know what month you are querying for, you could use Carbon within the where clause
(untested)
$augustRecords = EventModel::where(Carbon::createFromFormat('Y-m-d', '2015-08-01')->startOfMonth())->where(Carbon::createFromFormat('Y-m-d', '2015-08-01')->endOfMonth())->get();
If you want a recordset with multiple months and be able to group them, you could convert the date to a string containing the month and year within the SQL and group based on that - retaining all records, but allowing you to order/sort using SQL and output with any grouping you'd need.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community