Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tisuchi/a705e6d81308d9d6133954a3827404f2 to your computer and use it in GitHub Desktop.

Select an option

Save tisuchi/a705e6d81308d9d6133954a3827404f2 to your computer and use it in GitHub Desktop.
Laravel fetch results grouped by days // larademy.com
$users =DB::table('users')
->select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as views'))
->groupBy('date')
->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment