i want to pass an array on blade and in my foreach i get unique value if a value already display it don't display
i am beginer in laravel
my blade file code
@foreach($user as $users)
<tr>
<td>@foreach($role as $roles)
,
@endforeach</td>
<td> </td>
</tr>
@endforeach
</tbody>
my controller
public function roles(Request $request) {
$user=DB::table('user')->join('model_has_roles', 'id', '=', 'model_has_roles.model_id')->get()->toArray();
$role=DB::table('roles')->join('model_has_roles', 'id', '=', 'model_has_roles.role_id')->get()->toArray();
return view('role',compact('user','role'));
}
it display role against any user user did not duplicate
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire