Answers for "laravel 8 groupby('created_at') at 3 days"

PHP
1

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
0

laravel groupby and latest

//If You want the latest id of records then you can use unique() after get(),
//don't use group by if you use groupBy 
//then you lose your control from id. I hope this is useful for you

myModel::select('id','purch','name','prcvalue')
  ->where('purch','=','10234')
  ->orderBy('prcvalue','DESC')
  ->get()
  ->unique('name');
Posted by: Guest on June-14-2021

Code answers related to "laravel 8 groupby('created_at') at 3 days"

Browse Popular Code Answers by Language