request = $request; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { if(is_array($value)){ return true; } $total = $this->request->totalItems ?? -1; $removeCount = $this->request->removedItems ?? []; if($total === count($removeCount)){ return false; } if($total < 0 && $value === null){ return false; } return true; } /** * Get the validation error message. * * @return string */ public function message() { return 'Поле медиа обязательно для заполнения!'; } }