<table id="example4" class="table table-striped table-bordered dt-responsive nowrap" style="width:100%">
    <thead>
        <tr>
            <th>Sr.No</th>
            <th>MRD No</th>
            <th>Patient Name</th>
            <th>IOL Name</th>
            <th>IOL Type</th>
            <th>Power</th>
            <th>Date</th>

        </tr>
    </thead>
    <tbody>
        @php $i=1;@endphp
        @foreach($data as $result)
        <tr>
            <td>{{$i}}</td>
            <td>{{$result->MrdNo}}</td>
            <td>{{$result->PatientName}}</td>
            <td>{{$result->Cname}}</td>
            <td>{{$result->Model}}</td>
            <td>{{$result->Power}}</td>
            <td>{{date("d/m/Y", strtotime(str_replace('-', '/',$result->StockDate)))}}</td>

        </tr>
        @php $i++;@endphp
        @endforeach
       
    </tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
    $('#example4').DataTable({
        "scrollX": true,
        "pageLength":20,
        dom: 'Bfrtip',
        buttons: [

            'excelHtml5'

        ]
    });
});
</script>