Skip to content

Commit bab1b28

Browse files
[12.x] Document Enum::cases() (#10684)
* [12.x] Document Enum::cases() * Update migrations.md --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent e5aa7c9 commit bab1b28

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

migrations.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,14 @@ The `enum` method creates a `ENUM` equivalent column with the given valid values
686686
$table->enum('difficulty', ['easy', 'hard']);
687687
```
688688

689+
Of course, you may use the `Enum::cases()` method instead of manually defining an array of allowed values:
690+
691+
```php
692+
use App\Enums\Difficulty;
693+
694+
$table->enum('difficulty', Difficulty::cases());
695+
```
696+
689697
<a name="column-method-float"></a>
690698
#### `float()` {.collection-method}
691699

0 commit comments

Comments
 (0)