From 7a3087cbb4d01d3db58a03312b08ac487800fed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Wed, 6 Aug 2025 18:26:58 +0200 Subject: [PATCH 1/2] [12.x] Document Enum::cases() --- migrations.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migrations.md b/migrations.md index a4c9d5cb4f8..ccd11282f64 100644 --- a/migrations.md +++ b/migrations.md @@ -686,6 +686,14 @@ The `enum` method creates a `ENUM` equivalent column with the given valid values $table->enum('difficulty', ['easy', 'hard']); ``` +You may use the `Enum::cases()` method insteand of passing an `array` directly as the allowed values: + +```php +use App\Enums\Difficulty; + +$table->enum('difficulty', Difficulty::cases()); +``` + #### `float()` {.collection-method} From 742a6b0abbd368aa5b1125b5fff3feec1b9c071c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 6 Aug 2025 12:27:21 -0500 Subject: [PATCH 2/2] Update migrations.md --- migrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations.md b/migrations.md index ccd11282f64..e4dd940c598 100644 --- a/migrations.md +++ b/migrations.md @@ -686,7 +686,7 @@ The `enum` method creates a `ENUM` equivalent column with the given valid values $table->enum('difficulty', ['easy', 'hard']); ``` -You may use the `Enum::cases()` method insteand of passing an `array` directly as the allowed values: +Of course, you may use the `Enum::cases()` method instead of manually defining an array of allowed values: ```php use App\Enums\Difficulty;