Laravel5.2: how to read the checkbox saved in a column? For example, there is a set of check boxes: {code ...} in the controller, receive the selected items: {code ...} after receiving the message, use json_encode () to convert it to json format and save it in a column of the data table. The problem is: on the "Edit page... laravel 5.2: how to read the checkbox stored in a column?
For example, there is a set of check boxes below:
{!! Form::open(array('url' => 'foo/bar')) !!} 1 2 3
Submit {!! Form::close() !!}
In the controller, receive the selected items:
$checkboxes = $request->input('checkbox');
After receiving the message, use json_encode () to convert it to json format and save it in a column of the data table,
The problem is:
On the "Edit page", you need to read these items. When displayed on the "Edit page", the previously selected items will be selected, and the unselected items will not be selected, what should I do?
Reply content:
Laravel 5.2: how to read the checkbox stored in a column?
For example, there is a set of check boxes below:
{!! Form::open(array('url' => 'foo/bar')) !!} 1 2 3
Submit {!! Form::close() !!}
In the controller, receive the selected items:
$checkboxes = $request->input('checkbox');
After receiving the message, use json_encode () to convert it to json format and save it in a column of the data table,
The problem is:
On the "Edit page", you need to read these items. When displayed on the "Edit page", the previously selected items will be selected, and the unselected items will not be selected, what should I do?
The read data json_decode () is converted into an array, and the checked attribute is returned when the value is equal cyclically on the page.