Skip to content

Commit 556a8b7

Browse files
committed
Exclude specific accessors based on trait instead of class
1 parent 6a8444e commit 556a8b7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Console/ModelsCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,10 @@ public function getPropertiesFromMethods($model)
574574
if ($methodReflections) {
575575
$methodReflections = array_filter($methodReflections, function ($methodReflection) {
576576
return !$methodReflection->isPrivate() && !(
577-
$methodReflection->getDeclaringClass()->getName() === \Illuminate\Database\Eloquent\Model::class && (
577+
in_array(
578+
\Illuminate\Database\Eloquent\Concerns\HasAttributes::class,
579+
$methodReflection->getDeclaringClass()->getTraitNames()
580+
) && (
578581
$methodReflection->getName() === 'setClassCastableAttribute' ||
579582
$methodReflection->getName() === 'setEnumCastableAttribute'
580583
)

0 commit comments

Comments
 (0)