In my Laravel 5.2 app, I have the following validation rules to check a field:
$rules = array(
'file' => 'mimes:jpg,png,pdf,doc,docx',
'file' => 'validate_file'
);
Now, the validate_file
is a custom validation rule. I want to run it only only if the first mimes
validation passes.
I know I could simply validate/redirect with errors - in two batches, first the mimes
, then the validate_file
, but it seems like an overkill.
Any way I can do it the smart way in Laravel 5.2?