From 51e2f7f2b872cb207d8ea2c3aaf985a690a3dd7a Mon Sep 17 00:00:00 2001 From: jqh <841324345@qq.com> Date: Mon, 7 Sep 2020 10:54:02 +0800 Subject: [PATCH] fix #525 --- src/Form/Builder.php | 2 +- src/Widgets/Form.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Form/Builder.php b/src/Form/Builder.php index c9b65a2b9..473defd60 100755 --- a/src/Form/Builder.php +++ b/src/Form/Builder.php @@ -507,7 +507,7 @@ public function field($name) { $field = $this->fields->first(function (Field $field) use ($name) { if (is_array($field->column())) { - return in_array($name, $field->column(), true); + return in_array($name, $field->column(), true) ? $field : null; } return $field === $name || $field->column() === $name; diff --git a/src/Widgets/Form.php b/src/Widgets/Form.php index 4f064b3e4..82b8a3b73 100755 --- a/src/Widgets/Form.php +++ b/src/Widgets/Form.php @@ -363,7 +363,7 @@ public function field($name) { foreach ($this->fields as $field) { if (is_array($field->column())) { - return in_array($name, $field->column(), true); + return in_array($name, $field->column(), true) ? $field : null; } if ($field === $name || $field->column() === $name) {