I have my form as this with check box
<input type="checkbox" value="1" name="actions_id">
<input type="checkbox" value="2" name="actions_id">
<input type="checkbox" value="3" name="actions_id">
I want that if i select the 3 it saves into the database in json
i have this in my repository
public function updateMenuRoles(Request $request, $id)
{
$form = Action::create(array($id));
return $form;
}
Note: The form is not a create form, it is an update form so when you click edit and you saves the data but if you make changes to the checkbox by checking maybe one or two and then you click submit it generates another data in the database.
What i want is for it to update the previous one generated instead of always creating new record
I have this in my controller
public function updateRole(Request $request, $id)
{
$form = $this->accesscontrolRepository->updateMenuRoles($request, $id);
$form->actions_id = $request->actions_id;
$form->update();
return response()->json();
}