dimanche 4 décembre 2016

Laravel 5.3 validate select input and store in database

I have a registration form and i added 3 select input for date of birth user.

Here the HTML code.

http://ift.tt/2gr3CIc

In my RegisterController.php I've added following rules for validation.

'day'       => 'required|in:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31',
'month'     => 'required|in:1,2,3,4,5,6,7,8,9,10,11,12',
'year'      => 'required|in:2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992',

Again in my RegisterController.php for user creation i added field for store the date in my database

'dob'      => $data['day' . 'month' . 'year']

In the User Model I've added in protected fillable my field but this don't work.



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

Aucun commentaire:

Enregistrer un commentaire