1
0
Fork 0
mirror of https://github.com/archtechx/enums.git synced 2025-12-12 20:44:03 +00:00

mention defaultValue() in README

This commit is contained in:
Samuel Štancl 2024-07-15 16:28:34 +02:00 committed by GitHub
parent 5be8a58974
commit 37326d5e26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -351,6 +351,8 @@ And now the returned color will be correctly transformed:
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
```php
TaskStatus::fromMeta(Color::make('green')); // TaskStatus::COMPLETED