Change ToJson on Base Enum
This commit is contained in:
parent
a79173ec38
commit
df8022c495
2 changed files with 10 additions and 2 deletions
|
|
@ -30,4 +30,9 @@ All notable changes to `Enum` will be documented in this file.
|
|||
## Version 0.1.1
|
||||
|
||||
### Fixed
|
||||
- fixed performances issue on toValues and toLabels
|
||||
- fixed performances issue on toValues and toLabels
|
||||
|
||||
## Version 0.1.2
|
||||
|
||||
### Changed
|
||||
- changed toJson to output array with label and value
|
||||
|
|
|
|||
|
|
@ -267,7 +267,10 @@ abstract class BaseEnum implements JsonSerializable, UrlRoutable
|
|||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->value;
|
||||
return [
|
||||
'value' => $this->value,
|
||||
'label' => $this->label
|
||||
];
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue