Asked by: Sai Krishna
I'm currently using this
Bills::select( \DB::raw('DATE(`created_at`) as `date`'),\DB::raw('COUNT(*) as `count`'))->whereBetween('created_at', [Carbon\Carbon::parse('last sunday')->startOfDay(),Carbon\Carbon::parse('next monday')->endOfDay(), ]) ->groupBy('date')->get() ;
but is there better Eloquent query to search within the calendar week and group the daily count by days?
No comments:
Post a Comment