Kaynağa Gözat

hasmany rules

jqh 4 yıl önce
ebeveyn
işleme
ff2c49f287
1 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  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);
     }