【发布时间】:2021-07-08 08:55:00
【问题描述】:
我的问题很简单,目前我的系统显示了一个表格及其所有条目:
<table id="inventarios" class="table table-striped table-bordered shadow-lg mt-4" style="width: 100%">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Nombre</th>
<th scope="col">Unidad</th>
<th scope="col">Acciones</th>
</tr>
</thead>
<tbody>
@foreach($inventarios->where('uni_id',) as $inventario )
<tr>
<td>{{$inventario->id}}</td>
<td>{{$inventario->nombre}}</td>
<td>{{$inventario->uni_id}}</td>
<td>
<form action="{{ route ('inventarios.destroy',$inventario->id) }}" method="POST">
<a href="/inventarios/{{$inventario->id}}/edit" class="btn btn-info">Editar</a>
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Borrar</button>
</form>
</td>
</tr>
@endforeach
问题是只有标记为 ADMIN 的用户才能查看所有条目,而其他用户只能查看属于他们单位的表。
每个创建的用户都属于一个单元,这个单元可以创建“Inventarios”。我想知道如何让用户看到他们自己的“Inventarios”,而不是桌子上的所有条目。
我正在使用 Laravel 8,PHP。
【问题讨论】:
-
张贴您的餐桌样本...
标签: php datatables laravel-8