Skip to content

Commit

Permalink
Allow enum binding (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona authored Sep 8, 2023
1 parent eaa380a commit 0f64fc4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ protected function resolveParameter($attributes, $parameterName, $parameterClass
return $parameterValue;
}

if(enum_exists($parameterClassName)){
$enum = $parameterClassName::tryFrom($parameterValue);

if($enum !== null){
return $enum;
}
}

$instance = app()->make($parameterClassName);

if (! $model = $instance->resolveRouteBinding($parameterValue)) {
Expand Down

0 comments on commit 0f64fc4

Please sign in to comment.