Updating the record with the values changed in the form works fine but the checkbox value remains the same in database, weather it was checked or not. In database, I have a field multiassign which contains 0 or 1. I think there's something wrong with my html code.
html:
<div class="form-group{{ $errors->has('multiassign') ? '' : '' }}" style="float:left">
<input type="checkbox"
class="form-control{{ $errors->has('multiassign') ? ' is-invalid' : '' }}"
name="multiassign"
value="{{ old('multiassign', $process->multiassign) }}" {{ $process->multiassign ? 'checked' : '' }} />
@include('alerts.feedback', ['field' => 'multiassign'])
</div>
controller:
public function update(ProcessRequest $request, Process $process)
{
Log::info($request->all());
$process->update($request->all());
return redirect()->route('process.index')->withStatus(__('Saved!'));
}
log:
[2020-07-20 12:46:52] local.INFO: array (
'_token' => 'yOQ7x5UfuWtj0MZjMAvIE5bqHuESZYR3geD0Bx0J',
'_method' => 'put',
'id' => 'X0013',
'title' => 'Repair',
'client' => 'Example Client',
'multiassign' => '1',
)
in browser (for originally checked, value 1 in database)
<input type="checkbox" class="form-control" name="multiassign" value="1" checked />