Skip to content

Commit 9344093

Browse files
authored
Merge pull request #310 from bscheshirwork/use-getter-in-ar
read getter of AR if attribute not found
2 parents cad3cc2 + d092a27 commit 9344093

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/BaseColumn.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ protected function prepareValue($contextParams = [])
253253
$relation = $data->getRelation($this->name, false);
254254
if ($relation !== null) {
255255
$value = $relation->findFor($this->name, $data);
256-
} else {
256+
} elseif ($data->hasAttribute($this->name)) {
257257
$value = $data->getAttribute($this->name);
258+
} else {
259+
$value = $data->{$this->name};
258260
}
259261
} elseif ($data instanceof Model) {
260262
$value = $data->{$this->name};

0 commit comments

Comments
 (0)