我希望按时间更新权限的状态,并根据给定的角色给出权限。
每个角色都有自己的ID并且它正在显示但是我还必须更新关于角色ID的权限,但是foreach循环被赋予我的UI刚分散的形式。所以如何给表单提供id来更新表单中的元素
<div class="col-lg-3 col-md-3">
<a href="#" id="createType" class="btn btn-primary btn-block" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus"></i> Add Positions</a>
@foreach($data as $key=>$item)
<div class="roles-menu">
<ul class="nav" id="item_id">
<li><a href="">{{ $item->name }}</a></li>
<input id="input" value="{{ $item->id }}">
</ul>
</div>
@endforeach
</div>
<form method="post" action="{{ url('/system-configurations/roles-permission/permission') }}">
{{ csrf_field() }}
{{--<input name="role_id" value="">--}}
<div class="col-sm-9 module-access">
<h6 class="panel-title mb-20 display-ib">Module Access</h6>
<div class="pull-right mb-10">
{{--<select class="form-control">--}}
{{--<option>Select Module</option>--}}
{{--</select>--}}
</div>
<div class="panel">
<ul class="list-group">
<li class="list-group-item">
User Management
<div class="pull-right">
<label class="switch">
<input type="checkbox" name="user_management">
<span class="slider-switcher round"></span>
</label>
</div>
</li>
<li class="list-group-item">
HR Management
<div class="pull-right">
<label class="switch">
<input type="checkbox" name="hr_management">
<span class="slider-switcher round"></span>
</label>
</div>
</li>
<li class="list-group-item">
Finance
<div class="pull-right">
<label class="switch">
<input type="checkbox" name="finance">
<span class="slider-switcher round"></span>
</label>
</div>
</li>
</ul>
</div> <div class="table-responsive">
<table class="table table-hover" id="tableBody">
<thead>
<tr>
<th>Module Permission</th>
<th class="text-center">Read</th>
<th class="text-center">Write</th>
<th class="text-center">Create</th>
<th class="text-center">Delete</th>
<th class="text-center">Import</th>
<th class="text-center">Export</th>
</tr>
</thead>
<tbody>
<tr>
<td>User Management</td>
<td class="text-center">
<input type="checkbox" name="user_management_read" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="user_management_write" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="user_management_create" checked="">
</td>
</tr>
<tr>
<td>HR Management</td>
<td class="text-center">
<input type="checkbox" name="hr_management_read" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="hr_management_write" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="hr_management_create" checked="">
</td>
</tr>
<tr>
<td>Finance</td>
<td class="text-center">
<input type="checkbox" name="finance_read" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="finance_write" checked="">
</td>
<td class="text-center">
<input type="checkbox" name="finance_create" checked="">
</td>
</tr>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-12 text-right">
<button class="btn btn-info">Save</button>
</div>
</div>
</form>