Answers for "laravel group by day"

PHP
0

Laravel Eloquent, group by month/year

$model->select(DB::raw('count(id) as `data`'), DB::raw("DATE_FORMAT(created_at, '%m-%Y') new_date"),  DB::raw('YEAR(created_at) year, MONTH(created_at) month'))
->groupby('year','month')
->get();
Posted by: Guest on January-20-2021
0

laravel group by created_at date only

//Laravel ⛳

DB::table('table_name')
  ->select('*',DB::raw('DATE(created_at) as date'))
  ->get()->groupBy('date');
Posted by: Guest on August-07-2021

Browse Popular Code Answers by Language