i have problem with printing user id in bootstrap modal in php foreach (laravel framework)
i have below code:
@foreach($users as $user)
<tr>
<td> {!! $user->name !!}</td>
<td> {!! $user->email !!}</td>
<td>
<td>
<a class="btn btn-app" href="#" data-toggle="modal" data-target="#modal-danger">
<i class="fa fa-trash"></i>delete
</a>
<div class="modal modal-danger fade" id="modal-danger">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">delete</h4>
</div>
<div class="modal-body">
<p>are you sure wana delete this user?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">no</button>
{{-- <a class="btn btn-outline" href="{{action('UserController@delete',[$user->id]) }}" >
yes </a>--}}
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</td>
</tr>
@endforeach
first i want to print all users information in table. and want delete user with html link. so i need his/her id, but when i print table just latest user id is printed in modal…every thing is fine in foreach but in modal just latest user id will print and for every user i press delete button just latest user will delete.
i think bootstrap modal just print once and every time in foreach this modal replacing,
do you know how can i solve this problem?