Home >Backend Development >PHP Tutorial >Laravel 5.1 form submission data (including array) insert database error solution
When there is a need to submit an array to the database in the form, such as adding some customer service QQ information, Laravel will throw an error that the input field cannot be an array, and the solution is also very simple. Adding multiple QQ customer service requires the use of arrays Error thrown
Solution: In the model, "block" the fields that need to be submitted, use Input alone to receive and serialize them in the controller, and then save them. Model example:
Controller example
Similarly, just deserialize it when displaying. Original address: http://note.mango.im/article/24 |