Support the ongoing development of Laravel.io →
posted 10 years ago
Input
Last updated 2 years ago.
0

You should concatenate your fields to one string first. I don't know what format you use, but here's the idea:

$birthdate = sprintf('%s-%s-%s', Input::get('year'), Input::get('month'), Input::get('day'));

Then you pass it to your validator and use regular date rule like this:

$validator = Validator::make(
	array(
		// some fields
		'birthdate' => $birthdate
	),
	array(
		// some rules
		'birthdate' => 'required|date'
	)
);

You need to take care of the date to be valid strtotime string. I assumed somebody's forced to type two digits for day and month and four digits for year.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.