I have role edit form which I want to be able to edit the role permissions. In my controller I've added this
public function edit($id)
{
$role = Role::find($id);
$permission = Permission::get();
$rolePermissions = DB::table("permission_role")->where("permission_role.role_id",$id)
->pluck('permission_role.permission_id','permission_role.permission_id');
return view('roles.edit',compact('role','permission','rolePermissions'));
}
Then I've trying to display which permissions has this role so I can check/uncheck and edit them. In my view I have this loop
@foreach($permission as $value)
<label>
</label><br/>
@endforeach
But I've got the error for the array
- in_array() expects parameter 2 to be array, object given
on this line:
What is the problem here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire