When using laravel, the problem of saving checkboxes to the database
滿天的星座
滿天的星座 2017-05-16 16:51:04
0
1
527

When using laravel, there is a problem with saving check boxes to the database. This is the demo of html:
https://jsfiddle.net/4j3hoyvn/

Question:
How to save the checkbox in the form in the database? Create a separate table?

The effect to be achieved:
When the "Edit Page" is opened, the check box items selected when creating must be selected. I know how to do radio buttons and other types, but I don't know how to do check boxes.

滿天的星座
滿天的星座

reply all(1)
为情所困

1. If you are using laravel’s FROMS library, you can judge by blade’s @if and then use it

Form::checkbox('name', 'value', true);

To generate the selected state of the check box;


2. Of course, you can also use js (such as jq) to change the checked status of the checkbox based on the value


3. You can also use vuejs or Angola’s data binding to change the checked status of the check box
Vuejs case

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template