mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 08:24:05 +00:00
Add valueOptions() to options trait
This commit is contained in:
parent
373a86a16e
commit
3d76034952
1 changed files with 6 additions and 0 deletions
|
|
@ -17,4 +17,10 @@ trait Options
|
|||
? array_column($cases, 'value', 'name')
|
||||
: array_column($cases, 'name');
|
||||
}
|
||||
|
||||
/** Get an associative array of [case value => case value]. */
|
||||
public function valueOptions(): array
|
||||
{
|
||||
return array_column(static::cases(), 'value', 'value');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue