Browse Source

hasmany rules

jqh 4 years ago
parent
commit
ff2c49f287
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/Form/Field/HasMany.php

+ 11 - 0
src/Form/Field/HasMany.php

@@ -189,6 +189,17 @@ class HasMany extends Field
 
         $newInput += $input;
 
+        if ($hasManyRules = $this->getRules()) {
+            if (! Arr::has($input, $this->column)) {
+                return false;
+            }
+
+            $newInput += $this->sanitizeInput($input, $this->column);
+
+            $newRules[$this->column] = $hasManyRules;
+            $attributes[$this->column] = $this->label;
+        }
+
         return Validator::make($newInput, $newRules, array_merge($this->getValidationMessages(), $messages), $attributes);
     }