diff --git a/src/model/concern/Attribute.php b/src/model/concern/Attribute.php index e060a625..4d22064b 100644 --- a/src/model/concern/Attribute.php +++ b/src/model/concern/Attribute.php @@ -712,6 +712,7 @@ public function withFieldAttr(string | array $name, ?Closure $callback = null) } } else { $name = $this->getRealFieldName($name); + $this->append([$name], true); if (str_contains($name, '.')) { [$name, $key] = explode('.', $name); @@ -719,7 +720,6 @@ public function withFieldAttr(string | array $name, ?Closure $callback = null) $this->withAttr[$name][$key] = $callback; } else { $this->withAttr[$name] = $callback; - $this->append([$name], true); } }