Okay, so I have a form where it asks the user for:-
I then validate this with:
$rules = array(
'???' => 'required:date'
);
$validator = Validator::make($data, $rules);
But I have no idea where/what I can do to put the date, month, year into something that I can put into my validation, whether it be on the view or in the validation process.
Thanks, Tom
If you want to use the linked validation rule your date needs to come in as a single field in a format that Laravel's date parser will be able to recognise (dd-mm-yyyy, dd/mm/yy, yyyy-mm-dd, etc.) - so your form should really contain a single text field called 'date' in this case.
If it comes in as three separate fields you need to turn them into a single field before they get near the validator. Something like this maybe:
$rules = [
'name' => ['required'],
'email' => ['required', 'email'],
'date' => ['required', 'date'],
];
// transform date from three separate fields to yyyy-mm-dd
// TODO: ensure the things are zero-padded maybe?
$date = Input::get('year').'-'.Input::get('month').'-'.Input::get('day');
$v = Validator::make(
Input::only('name', 'email') + ['date' => $date],
$rules
);