Skip to content

Commit

Permalink
改进关联字段的动态获取器的自动append
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Oct 10, 2024
1 parent 8a304c7 commit 407dfd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/model/concern/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,14 @@ 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);

$this->withAttr[$name][$key] = $callback;
} else {
$this->withAttr[$name] = $callback;
$this->append([$name], true);
}
}

Expand Down

0 comments on commit 407dfd7

Please sign in to comment.