I'm haven't tried this but I'm thinking either you need to do your own validation or you could split the rules into groups and run multiple validations so that you can give them custome messages..
// First validation with custom error messages
$messages = [
'domain.required' => 'I pitty the fool who does not fill out the domain field',
'domain.string' => 'I also pitty stupid fools',
'domain.regex' => 'I might have to come kick your ass',
'domain.unique' => 'Yeah, I am coming for your ass!',
];
'domain' => [
'required',
'string',
'regex:~^[^@]+$~',
'unique:domain,name,NULL,id,status,suspended',
]
// Second validation with custom error messages
$messages = [
'domain.regex' => 'How hard is it.. ABCDEF...',
'domain.unique' => 'bleh',
];
'domain' => [
'regex:~^[a-zA-Z0-9\.-]+(\.[a-zA-Z]+)+$~',
'unique:domain,name,NULL,id,status,active',
]
// And so on... you get the point..
$messages = [
'domain.regex' => 'The Domain Name you entered looks like your mail server address.',
'domain.unique' => 'U.N.I.Q.U.E .... Gaaaaaaaaah!',
];
'domain' => [
'regex:~^(?!mail\.).+~',
'unique:domain,name,NULL,id,status,pending',
]
'domain' => [
'unique:alias,name,NULL,id,status,active',
]
'domain' => [
'unique:order_block,criteria',
]
Or maybe make a loop..
$customValidations = [
'regex:~^(?!mail\.).+~' => 'The Domain Name you entered looks like your mail server address.',
'regex:~^[a-zA-Z0-9\.-]+(\.[a-zA-Z]+)+$~' => 'Some other error message',
];
foreach($customValidations as $rule => $msg) {
$validator = Validator::make();
if($validator->fails()) {
return $msg;
}
}
Anyways, that's ll I got for 2 am.. good night and good luck.