|
|
@@ -57,6 +57,24 @@ class ReviewRequest extends FormRequest
|
|
|
return $rules;
|
|
|
}
|
|
|
|
|
|
+ public function withValidator($validator): void
|
|
|
+ {
|
|
|
+ $validator->after(function ($validator) {
|
|
|
+ $photos = $this->file('photos');
|
|
|
+
|
|
|
+ if (empty($photos)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((float) $this->input('stars') > 2) {
|
|
|
+ $validator->errors()->add(
|
|
|
+ 'photos',
|
|
|
+ __('validation.custom.review.photos_only_negative'),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
public function messages(): array
|
|
|
{
|
|
|
return [
|