Skip to content

Commit 0838121

Browse files
committed
Added abstract class detection when creating ownedby fields
1 parent 69565f7 commit 0838121

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Traits/GovernorOwnedByField.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ protected function createGovernorOwnedByFieldsByPolicy(BasePolicy $policy): bool
3333

3434
protected function createGovernorOwnedByFields(Model $model): bool
3535
{
36-
if (! in_array("GeneaLabs\\LaravelGovernor\\Traits\\Governable", class_uses_recursive($model))) {
36+
$class = new ReflectionClass($model);
37+
38+
if (
39+
! in_array("GeneaLabs\\LaravelGovernor\\Traits\\Governable", class_uses_recursive($model))
40+
|| $class->isAbstract()
41+
) {
3742
return false;
3843
}
3944

0 commit comments

Comments
 (0)