here is input value : FIRST_TIME_ARRIVAL_DATE_AT_DAW : 2016-21-5 17:21:35 here is validation rule :
public static $createRules = [
'FIRST_TIME_ARRIVAL_DATE_AT_DAW' => 'date_format:"Y-m-d H:i:s"',
];
and it doesn't validatate, it return :
{"CELLS_EXPIRY_DATE":["The FIRST TIME ARRIVAL DATE AT DAW does not match the format Y-m-d H:i:s."]
EDIT: here is what my controller looks like:
$validator = Validator::make($request->all(),BatteryAssets::$createRules);
if ($validator->fails()) {
return ['success' => 0, 'data' => 'Input error','errors' => $validator->messages()->toJson()];
}
so $validator->messages()->toJson() return the validation error
requiredto the rule.