当没有设置LIMIT时,数组限制为10个值

时间:2018-03-27 02:53:18

标签: php arrays laravel eloquent limit

我有一个代码,用于创建将组合在一起的日期的数组键和将计算不同id的数量的数组值。这将在用户选择“TO”和“从“日期......所以当我做一些测试时,我注意到一些奇怪的事情,数组只限制到10个值。例如,如果我在1/3/2018 - 20/3/2018之间选择日期,那么它仅从1/3/2018 - 10/3/2018返回。当我没有对它设置任何限制时,为什么会发生这种情况。 我在控制器中的代码:

public function graphheheByDate(Request $request, $companyID)
{
  $companyID = $this->decode($companyID);

  $matchs = DiraChatLog::whereBetween('date_access', [$request->from, $request->to])->orderBy('date_access', 'asc')->get();
  foreach ($matchs as $key => $match) {
    $time = strtotime($match->date_access); 
    $newformat = date('Y-m-d',$time);
    $a[$newformat] = $this->testing($newformat,$match);
  }

  dd($a);

  $user = array_values($a);
  $dates = array_keys($a);
  // dd($user, $dates);

  $from = $request->from;
  $to = $request->to;
  // dd($from, $to);

  $companyID = $this->encodeID($companyID);

  return view('AltHr.Chatbot.graphhehe', compact('companyID','from','to', 'dates'))->with('user',json_encode($user,JSON_NUMERIC_CHECK))->with('dates',json_encode($dates,JSON_NUMERIC_CHECK));     
}

private function testing($date,$match)
{
  $a = Carbon::parse($date)->addDay()->toDateTimeString();
  // dd($a,$date);

  $noOfUsers = DiraChatLog::whereBetween('date_access', [$date,$a])->get();
  // dd($noOfUsers);

  return $noOfUsers->groupBy('user_id')->count();
}

使用这个我选择了日期为1/3/2018 - 20/3/2018,但它的回复就像 enter image description here

0 个答案:

没有答案