From 96bd56a8287123261b6e1d606cd06564a53e7b6c Mon Sep 17 00:00:00 2001 From: James Collins Date: Mon, 8 May 2023 21:45:11 +1000 Subject: [PATCH] obsolete --- app/Rules/RequiredIfAny.php | 71 ------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 app/Rules/RequiredIfAny.php 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); - } -}