I add a custom Validation Rule
Validator::extend('validate_timezone', function($attribute, $value, $parameters, $validator) {
$items = request('items');
$from_date = Carbon::createFromFormat('Y-m-d H:i:s', $item['from_date']);
// my code below depend on $from_date
......
......
return true;
);
validation rule
"from_date" => "required|date_format:Y-m-d H:i:s|validate_timezone",
the problem , custom validation validate_timezone run before 'date_format:Y-m-d H:i:s' ,so if the format of date is wrong , i will get error inside validate_timezone function
how can i force to validate date_format:Y-m-d H:i:s before the custom validation validate_timezone?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/33z5KWB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire