Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jayanthkumar's avatar

how to filter data between the date and view content

Hi i am getting all the Data from DB and i am able to show in table format but now i need to make better by adding filter of 2 date selector and one button

by on click i need to show the contents entered with in that range how to do this

here is my view

<table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
                      <thead>
                        <tr>
                          <th>Customer name</th>
                          <th>Phone Number</th>
                          <th>State</th>
                          <th>District</th>
                          <th>City/Taluk/Mandal</th>
                          <th>Payment</th>  
                          <th>Payment Status</th>
                          <th>Sales person</th> 
                          <th>Invoice Number</th>
                          <th>Invoice Date</th>
                          
                          
                          <th>More Options</th>
                        </tr>
                      </thead>
                      <tbody>
                        
                        @foreach($custom as $cust )
                        
                       <tr>
                        <td>{{ $cust->customer_name}}</td>
                        <td>{{ $cust->phone}}</td>
                        <td>{{ $cust->state}}</td>
                        <td>{{ $cust->district}}</td>
                        <td>{{ "$cust->city"}}</td>
                        
                        
                        
                        <td>@if($cust->mode_of_payment == 1)
                              Cash   
                              @elseif ($cust->mode_of_payment == 2)
                              NEFT
                              @elseif ($cust->mode_of_payment == 3)
                              Payumoney
                              @elseif ($cust->mode_of_payment == 4)
                              Amazon
                              @elseif ($cust->mode_of_payment == 5)
                              Ebay
                              @elseif ($cust->mode_of_payment == 6)
                              Cash on delivery
                              @elseif ($cust->mode_of_payment == 7)
                              Others
                              @endif </td>
                        <td><a>@if($cust->payment_status == 1)
                              <p1 style="color:red">NOT PAID</p1>
                              <a href="<?php echo 'payment/' .$cust-> id  ?>">Make it Paid</a>
                            @elseif ($cust->payment_status == 2)
                              <p1 style="color:green">RECEIVED<p1> 
                            @elseif ($cust->payment_status == 3)
                              <p1>NOT APPLICABLE<p1>  
                              @endif</a></td>       
                        <td>{{ $cust->salesperson}}</td>      
                        <td>{{ $cust->invoice_number}}</td>
                        <td>{{ $cust->invoice_date}}</td>
                        {{--<td>{{ $cust->device_id}}</td>--}}
                        
                        {{--<td><a href="{{ url('invoice') }}">Show invoice</a></td>--}}
                        <td><a href="<?php echo 'invoice/' .$cust-> id  ?>">print invoice</a></td>
                        
                      
                        </tr>
                        @endforeach

                        
                        
                      </tbody>
                    </table>

in this table i am getting date in one coloumn so that i need a filter to show data present between that dates

need help....plz give some suggestions and tips for DATA TABLES

0 likes
0 replies

Please or to participate in this conversation.