Methmi
1 month ago
247
9
Laravel

Data cannot be shown with wherebetween

Posted 1 month ago by Methmi

This is my controller

 $machines = Machines::find($id);
       $sdate = $request->get('sdate');
        $edate = $request->get('edate');

        $dailyrunningcharts = dailyrunningcharts::where('drc_mid',$id)
        ->whereBetween('drc_date', [$sdate, $edate])
        ->get();

When I give this, It does not show any results, just empty table and then remove the wherebetween clause it shows the alldata in the table. This code is used in search function

This is my blade

 <form action="{{ route('edaterange',$employees->e_id)}}" method="get">
        <div class="form-row">

        <div class="col">
          <div class="form-group row">
            &nbsp
         <label >From :</label>
         <div class="col-sm-8">
         <input class="form-control" type="Date" name="sdate" value="{{$sdate}}">
       </div>
     </div>
        </div>
        <div class="col">
          <div class="form-group row">
         <label >To :</label>
         <div class="col-sm-8">
        <input class="form-control" type="Date" name="edate" value="{{$edate}}">
      </div>
        </div>
      </div>
       <button class="btn btn-success" style="height: 40px;" >Filter</button>
       &nbsp &nbsp
        <a href="{{ route('e_overview_report',$employees->e_id)}}" type="submit" class="btn btn-primary" style="height: 40px;">Refresh</a>
        </div>
      </form>

How to get retrieve data with wherebetween.

Please sign in or create an account to participate in this conversation.