8 months ago

Multidimensional groupBy() (day then week then month)

Posted 8 months ago by wdotis

I'm trying to make a multidimensional groupBy() on a query. Let's say I have:

$query = Post::where('created_at', '>=', Carbon::now()->subMonth())->get();

Any ideas on how I can get something like?:

  • Today: today posts
  • Last week: last week posts minus today
  • Last month: last month posts minus today and last week

Please sign in or create an account to participate in this conversation.