일 현재 주 내에서 생성 된 모든 레코드의 수를 얻기 위해 어떻게 created_at 타임 스탬프를 사용하여 laravel 어제의로 일주 오래된 작성된 레코드의 수를 싶어, 내가 가진 :Laravel가 : 어제
//week date range upto current day
$name_current_day = date("l");
$name_current_week = date("Y-m-d",strtotime('monday this week')).'to'.date("Y-m-d",strtotime("$name_current_day this week"));
//query to get count
foreach($name_list as $name){
//created in week
$data[$network->name.'_week'] = Info::select(DB::raw('DATE(`created_at`) as `date`'),DB::raw('COUNT(*) as `count`'))
->where('created_at', '>', $name_current_week)
->where('name',$name->f_name)
->groupBy('date')
->orderBy('date', 'DESC')
->lists('count', 'date');
}
이 쿼리를 실행하면 정확한 결과를 얻지 못하고 있습니다. Laravel에서 지난 7 일간의 레코드를 얻을 수있는 방법입니다.