1$user_info = DB::table('usermetas')
2 ->select('browser', DB::raw('count(*) as total'))
3 ->groupBy('browser')
4 ->get();
1//If You want the latest id of records then you can use unique() after get(),
2//don't use group by if you use groupBy
3//then you lose your control from id. I hope this is useful for you
4
5myModel::select('id','purch','name','prcvalue')
6 ->where('purch','=','10234')
7 ->orderBy('prcvalue','DESC')
8 ->get()
9 ->unique('name');
10