Skip to content

Commit

Permalink
Fix Trying to get property 'value' of non-object (#9)
Browse files Browse the repository at this point in the history
This trick solve an issue on eloquent creation.
  • Loading branch information
trippo authored Feb 11, 2020
1 parent f9d5c39 commit 6b41765
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public function attachEnum($class)
->rules('required', new EnumValue($class, false))
->resolveUsing(
function ($enum) {
return $enum->value;
return $enum ? $enum->value : null;
})
->displayUsing(
function ($enum) {
return $enum->description;
return $enum ? $enum->description : null;
});
}

Expand Down

0 comments on commit 6b41765

Please sign in to comment.