Custom Validation Rule not showing failure message in File upload field.

Hello all. I was trying to make a custom validation rule for a file upload field, but this was returned instead of the correct error message: Illuminate\Validation\ClosureValidationRule. So i thought of making a rule class but when I do that the path of the rule is returned instead. Below is my code for the file upload field:

 Forms\Components\FileUpload::make('data')
                    ->required()
                    ->maxSize(128000)
                    ->rules([new DataValidationRule()])
                    ->hidden(function (Get $get) {
                        $type = $get('type');
                        return $type === TypeEnum::WITH_WEIGHTS->value;
                    }),
Was this page helpful?