I am stuck about a problem, in fact I want to create a Role
and a Permission
. In my form.
I added the informations for each fields.
I have an error message:
ErrorException in RoleController.php line 44: Invalid argument supplied for foreach()
Here is a party of my code, I don't see the error??
public function store(Request $request)
{
$role=Role::create($request->except(['permission','_token']));
foreach ($request->permission as $key=>$value){
$role->attachPermission($value);
}
return redirect()->route('role.index')->withMessage('role created');
}
Thank you for your help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire