Мне нужно получить идентификатор по ссылке и передать его в действие формы для редактирования. Форма находится внутри модальной зоны.
Я хочу получить идентификатор библиотеки из таблицы, передать его действию формы и отправить его на мой LibraryController@edit.
<form action="{{ route('admin.libraries.edit',['id'=>$library->id]) }}" method="POST">
'Id' => $ library-> id всегда равен 1, что является первой строкой, но я хочу динамический идентификатор, который является идентификатором по нажатой ссылке
Это пример кода из моеготаблица
<tbody>
@foreach($libraries as $library)
<tr>
<td>{{ $library->id }}</td>
<td><a class="nav-item" href="#" data-toggle="modal" my- data-target="#editClearanceModal" >{{ $library->student->index_no}}</a></td>
<td>{{ $library->student->getName() }}</td>
<td>{{ $library->clearance}}</td>
</tr>
@endforeach
</tbody>
Это форма внутри модального
<div class="modal-body">
<form action="{{ route('admin.libraries.edit',['id'=>$library->id]) }}" method="POST">
@csrf
<table class="table table-hover table-bordered" id="sampleTable">
<thead>
<tr>
<th> Index Number </th>
<th> Name </th>
<th> Clearance {{ $library->id}}</th>
</tr>
</thead>
<tbody>
<tr>
<td> {{ $library->student->index_no }} </th>
<td> {{ $library->student->getName() }} </th>
<td>
<div class="form-check">
<label class="form-check-label">
@foreach ($library->getClearanceOptions() as $clearanceKey => $clearanceValue)
@if($library->clearance == $clearanceValue)
<input type="checkbox" class="form-check-input" name="clearance" id="clearance" value="{{$clearanceKey}}" {{$clearanceKey == 1 ? 'checked' : ''}}>
Check if cleared {{$library->clearance .''.$clearanceValue}}
@endif
@endforeach
</label>
</div>
</td>
</tr>
</tbody>
</table>