Laravel 从现在到将来获取记录

Laravel 从现在到将来获取记录,laravel,Laravel,我要所有的记录,从现在到将来 我不需要记录的日期报警是在过去 这是我的代码: $future=Carbon::now(); $time=$future->addMonth(); $records = document_date::where('date_alarm',$future)->whereHas('document')->with([ 'document' => function ($query) { $query->wi

我要所有的记录,从现在到将来 我不需要记录的日期报警是在过去

这是我的代码:

 $future=Carbon::now();
 $time=$future->addMonth();
 $records = document_date::where('date_alarm',$future)->whereHas('document')->with([
     'document' => function ($query) {
          $query->with([
              'userClients' => function ($query) {
                    $query->where('type', 4)->with(['users']);
               }
           ]);
       }
   ])->orderBy('date', 'DESc')->get();
我该怎么做呢?

用whereween('date\u alarm'[$now,$future])代替where

     $now=Carbon::now();
     $future=$now->addMonth();
 $records = document_date::whereBetween('date_alarm' [$now , $future])->whereHas('document')->with([
     'document' => function ($query) {
          $query->with([
              'userClients' => function ($query) {
                    $query->where('type', 4)->with(['users']);
               }
           ]);
       }
   ])->orderBy('date', 'DESc')->get();
您是否尝试过
where('date\u alarm','>=',$future)
?请使用
whereBetween('date\u alarm'[$now,$future])
,而不是where