Support the ongoing development of →
Database Eloquent
Last updated 2 years ago.

I don't understand the "grouping by weeks", is that week number by month (or year) or week_date? And with this kind of selecting, I'd rather use raw sql instead (DB::query()). Something like:

select week(time) as week_select from <table> group by week_select;

Or using mysql TimeDiff function. The worst case is you have to pull all data and process it manually by php, which is of course more freedom.

Last updated 2 years ago.

My hope is that I can do it with the same dataset.

As for week number by month, vs week_date, I know ideally i'd want week number. However, with what i've been playing around with carbon combined with goofy loops, I'm not sure I can get that.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.