mirror of
https://github.com/archtechx/enums.git
synced 2025-12-13 20:44:04 +00:00
mention defaultValue() in README
This commit is contained in:
parent
5be8a58974
commit
37326d5e26
1 changed files with 2 additions and 0 deletions
|
|
@ -351,6 +351,8 @@ And now the returned color will be correctly transformed:
|
||||||
TaskStatus::COMPLETED->color(); // 'text-green-500'
|
TaskStatus::COMPLETED->color(); // 'text-green-500'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also add a `defaultValue()` method to specify the value a case should have if it doesn't use the meta property. That way you can apply the attribute only on some cases and still get a configurable default value on all other cases.
|
||||||
|
|
||||||
#### Use the `fromMeta()` method
|
#### Use the `fromMeta()` method
|
||||||
```php
|
```php
|
||||||
TaskStatus::fromMeta(Color::make('green')); // TaskStatus::COMPLETED
|
TaskStatus::fromMeta(Color::make('green')); // TaskStatus::COMPLETED
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue