diff --git a/app/Rules/RequiredIfAny.php b/app/Rules/RequiredIfAny.php deleted file mode 100644 index 52dd095..0000000 --- a/app/Rules/RequiredIfAny.php +++ /dev/null @@ -1,71 +0,0 @@ -table = $table; - $this->columns = $columns; - } - - /** - * Determine if the validation rule passes. - * - * @param mixed $attribute Not used. - * @param mixed $value The value to compare. - * @return boolean - */ - public function passes(mixed $attribute, mixed $value) - { - foreach ($this->columns as $column) { - $result = DB::table($this->table) - ->where($column, '!=', '') - ->where($column, '!=', null) - ->where($attribute, '=', '') - ->exists(); - - if ($result !== null) { - return false; - } - } - - return true; - } - - /** - * Get the validation error message. - * - * @return string - */ - public function message() - { - return 'The :attribute field is required if any of the following fields are not empty: ' . implode(', ', $this->columns); - } -}