title: Laravel date search funtion
body: <p>how to add date search like DATE_FROM and DATE_TO? i have already existing  controller using search box and drop-down filter to my blade template, now how do i add date range filter. and also how to add it inside my date-picker in blade</p>
  
  <p><strong>Note:</strong> <em>in my database i only have the default created_at column</em> </p>
  
  <p>Controller:</p>
  
  <pre><code>public function index(Request $request)
  {
  
      $search=$request-&gt;input('search'); 
  
      if(request()-&gt;has('lead_status')){
          $leads=Lead::where('lead_status', request('lead_status'))
          -&gt;paginate(5)
          -&gt;appends('lead_status',request('lead_status'));
      }
      else{
  
          $leads=Lead::orderBy('created_at','desc')-&gt;search($search)-&gt;paginate(5);
  
      }
  
      return  view ('leads.index')-&gt;with('leads',$leads);
  
  }
  </code></pre>
  
  <p><strong>VIEW Date-Picker</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div class="col-sm-4 form-group"&gt;
      &lt;label&gt;FROM&lt;/label&gt;
      &lt;input type="date"  name="" value="" class="form-control"&gt;
                                 
  &lt;/div&gt;
  &lt;div class="col-sm-4 form-group"&gt;
      &lt;label&gt;TO&lt;/label&gt;
      &lt;input type="date"  name="" value="" class="form-control"&gt;
                                 
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>