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.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MmYyYg
via IFTTT
Aucun commentaire:
Enregistrer un commentaire