dimanche 6 août 2017

Laravel 5 Keep old input for bootstrap multiple select in edit form and get it values in controller

In Laravel 5.4, I have an edit form with multiple select option as below code:



Problem: After the form is submitted, all options (bot from database and manually selected) are deselect.

Form validation:

$validator = Validator::make($request->all(), [
   'id'            => 'required',
   "location.*"    => 'required|string|distinct|min:1',
]);

Question 1: How can I keep the old input of this multiple select option in the edit form work?

Question 2: How can I store the form value as array into the database?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hB0fnj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire