My project have list of customers. I want to edit the customers. All forms using bootstrap modals. In my customers list i used :
a href="{{route('admin.customers.edit',$id)}}" data-hover="tooltip" data-placement="top" data-target="#modal-edit-customers" data-toggle="modal" id="modal-edit" title="Edit"
Above link using for edit each item. When i click the edit link, I get the response from controller and populate the modal edit form for one time. Later link not working. If i refresh the page, it will work again for one time. Anyone help me to find the issue?
The short answer is that you must keep your modal within a "@foreach" loop, or you modal will return one record only. One caveat of using modals, it's server workload. You must be aware of the performance implications this will bring if you have 100's or 1000's of records. If you have 5 or 10 records showing in a list on a single page, it won't be troubling. However, if you're showing 100's of records at once. The performance decrement will be noticeable. As an answer to your question, for example(and extending the answer given by @MaverickChan ):
<table>
<thead>
...
<thead>
<tbody>
@foreach($yourModel as $SampleModels)
//Your other code implementation goes here
...
<a href="{{route('admin.customers.edit',$id)}}" data-hover="tooltip" data-placement="top" data-target="#modal-edit-customers{{ $id }}" data-toggle="modal" id="modal-edit" title="Edit"></a>
...
//Your other code implementation goes here
...
<div class="modal" id="modal-edit-customers{{ $id}}">
...modal body .....
</div>
@endforeach
</tbody>
</table>