I would like to execute the follow sentence using laravel eloquent
SELECT *, count(*) FROM reserves group by day
The only solution occurs to m
You could use:
#Laravel Raw Expressions $reserves = DB::table('reserves') ->select(DB::raw('count(*) as reserves_count')) ->groupBy('day') ->get(); OR $reserves = Reserve::select(['reserves.*']) ->groupBy('day') ->count();
Further read here