Skip to content

Commit

Permalink
mention defaultValue() in README
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl authored Jul 15, 2024
1 parent 5be8a58 commit 37326d5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 37326d5

Please sign in to comment.