Skip to content

Commit

Permalink
Update EnumEnhance.php
Browse files Browse the repository at this point in the history
适配Laravel11
  • Loading branch information
loserc6 authored and jiannei committed Nov 15, 2024
1 parent 59d40d0 commit 3e08125
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Support/Traits/EnumEnhance.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function value(): int|string

public function description(string $localizationGroup = 'enums'): string
{
$key = "$localizationGroup.".static::class.'.'.$this->name;
$name = (version_compare(app()->version(), '11.0.0', '>=') ? $this->value : $this->name);
$key = sprintf("%s.%s.%s", $localizationGroup, static::class, $name);

return Lang::has($key) ? Lang::get($key) : Str::of($this->name)->replace('_', ' ')->lower();
}
Expand Down

0 comments on commit 3e08125

Please sign in to comment.