Ejemplo n.º 1
0
 /**
  * Update a permission from form request
  *
  * @param Permission $permission
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(Permission $permission, Request $request)
 {
     $this->authorize('edit_users');
     $this->validate($request, ['name' => 'required|string|between:3,50', 'description' => 'string|between:0,100']);
     $permission->update($request->all());
     $group_list = $request->input('group_list') ?: [];
     $permission->groups()->sync($group_list);
     flash()->success('Permission Saved', 'The permission has been updated');
     return redirect('permission');
 }