예제 #1
0
 function countByAgentAndDateGroupByDate($agentId, $fromSql = null, $toSql = null)
 {
     $r = Sale::where('user_id', $agentId)->where('sale_status_id', Config::get('constants.sale_status.sale'));
     if ($fromSql && $toSql) {
         $r->where('date_sold', '>=', $fromSql)->where('date_sold', '<=', $toSql);
     }
     return $r->groupBy('date_sold')->select(['date_sold', DB::raw("count(*) as salesCount")])->orderBy('date_sold')->lists('salesCount', 'date_sold')->toArray();
 }