-
-
Save trevorgreenleaf/b9db0338cbdae0b7670ff985f7bc1172 to your computer and use it in GitHub Desktop.
Laravel Query Group, Year, Month, Day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$usage = DB::table('styles') | |
->select( | |
DB::raw('count(id) as `total_created`'), | |
DB::raw("DATE_FORMAT(created_at, '%d-%m-%Y') new_date"), | |
DB::raw(' | |
YEAR(created_at) year, | |
MONTH(created_at) month, | |
DAY(created_at) day') | |
) | |
->groupby('year','month','day') | |
->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment