Skip to content

Commit 11f61c4

Browse files
committed
refactor: simplify property type checking logic
1 parent 537bf39 commit 11f61c4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/database/src/IsDatabaseModel.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,11 @@ public function __get(string $name): mixed
347347
return $property->getValue($this);
348348
}
349349

350-
$type = $property->getType();
351-
352-
if ($type->isRelation()) {
350+
if (inspect(model: $this)->isRelation(name: $name)) {
353351
throw new RelationWasMissing($this, $name);
354352
}
355353

356-
if ($type->isBuiltIn()) {
354+
if ($property->getType()->isBuiltIn()) {
357355
throw new ValueWasMissing($this, $name);
358356
}
359357

0 commit comments

Comments
 (0)