May 29, 2024
0
Level 1
Standard validation rules are ignored when a custom validation rule is added
I have a Livewire upload form for CSV files using two standard validation rules and a custom validation object:
public function rules() {
return [
'csvFile' => ['file', 'mimes:txt,csv', new CsvRule]
];
}
The problem is that the first two rules are ignored. The validation immediately jumps into the custom CsvRule. This CsvRule works perfectly fine when used as the only validation rule:
public function rules() {
return [
'csvFile' => [new CsvRule]
];
}
Of course, if I only use the "file" and the "mimes" rules it also works. It's the combination of all three that doesn't work.
Any ideas?
Please or to participate in this conversation.