i'm trying to submit a modal to the controller, and doing a @foreach loop but when i try to send the id of the corresponding item's id, it sends the last value of the id, always = 13 :-
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($categories as $category)
<tr>
<td>{{ $category->id }}</td>
<td>{{ $category->name }}</td>
<td>
<button class="myBtn btn btn-primary">Edit</button>
<button class="btn btn-danger">Delete</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
so when i press on the edit button it always sends the last value of the id not the corresponding one
<form action="{{ route('category.update', $category->id) }}" method="post">
<div>
<label for="name">Name:</label>
<input type="text" id="Category Name" name="name">
</div>
<button type="submit" class="bn btn-success">Save</button>
{{ csrf_field() }}
</form>