diff --git a/docs/content/1_docs/3_modules/12_nested-modules.md b/docs/content/1_docs/3_modules/12_nested-modules.md
index ff12e6758..d5b399107 100644
--- a/docs/content/1_docs/3_modules/12_nested-modules.md
+++ b/docs/content/1_docs/3_modules/12_nested-modules.md
@@ -68,13 +68,13 @@ Route::get('{slug}', function ($slug) {
})->where('slug', '.*');
```
-For more information on how to work with nested items in your application, you can refer to the
+For more information on how to work with nested items in your application, you can refer to the
[laravel-nestedset package documentation](https://github.com/lazychaser/laravel-nestedset#retrieving-nodes).
### Setting a maximum nested depth
You can also define the maximum depth allowed for the module changing the following:
-```php
+```php
protected $nestedItemsDepth = 1;
```
Note: a depth of 1 means parent and child.
@@ -100,23 +100,20 @@ We'll use the `slug` and `position` features in this example but you can customi
```
php artisan twill:make:module issues -SP
-php artisan twill:make:module issueArticles -SP --parentModel=Issue
+php artisan twill:make:module issueArticles -SP --parentModel=Issue
```
Add the `issue_id` foreign key to the child module's migration:
```php
-class CreateIssueArticlesTables extends Migration
+public function up()
{
- public function up()
- {
- Schema::create('issue_articles', function (Blueprint $table) {
- // ...
- $table->foreignIdFor(Issue::class);
- });
-
+ Schema::create('issue_articles', function (Blueprint $table) {
// ...
- }
+ $table->foreignIdFor(Issue::class);
+ });
+
+ // ...
}
```
@@ -137,7 +134,7 @@ class IssueArticle extends Model implements Sortable
// ...
'issue_id',
];
-
+
public function issue()
{
return $this->belongsTo(Issue::class);
diff --git a/docs/content/1_docs/4_form-fields/11_repeater.md b/docs/content/1_docs/4_form-fields/11_repeater.md
index 6cbbc2f3c..838f0d829 100644
--- a/docs/content/1_docs/4_form-fields/11_repeater.md
+++ b/docs/content/1_docs/4_form-fields/11_repeater.md
@@ -179,19 +179,16 @@ php artisan twill:make:module TeamMember -P
relationship:
```php
-class CreateTeamMembersTables extends Migration
+public function up()
{
- public function up()
- {
- Schema::create('team_members', function (Blueprint $table) {
- /* ... */
-
- $table->foreignId('team_id')
- ->constrained()
- ->onUpdate('cascade')
- ->onDelete('cascade');
- });
- }
+ Schema::create('team_members', function (Blueprint $table) {
+ /* ... */
+
+ $table->foreignId('team_id')
+ ->constrained()
+ ->onUpdate('cascade')
+ ->onDelete('cascade');
+ });
}
```
@@ -306,5 +303,3 @@ of the repeater items. This directive also accepts a `hidePrefix` option to hide
:required="true"
/>
```
-
-
diff --git a/docs/content/1_docs/7_media-library/05_custom-metadata.md b/docs/content/1_docs/7_media-library/05_custom-metadata.md
index b18b20f56..6bedb3ce1 100644
--- a/docs/content/1_docs/7_media-library/05_custom-metadata.md
+++ b/docs/content/1_docs/7_media-library/05_custom-metadata.md
@@ -1,6 +1,6 @@
# Custom metadata
-By default, media comes with a few metadata attributes that can be filled in from the media managers:
+By default, media comes with a few metadata attributes that can be filled in from the media managers:
Tags, Alt text and caption.
Say we want to add more metadata, some of which might be translatable. To do this we have to go through a few
@@ -41,7 +41,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddFieldsToMedia extends Migration
+return new class extends Migration
{
public function up()
{
@@ -58,7 +58,7 @@ class AddFieldsToMedia extends Migration
$table->dropColumn('attribution');
});
}
-}
+};
```
And that is all. The most important part is to make sure your migration fields are named the same as your custom metadata values in the twill config.
diff --git a/docs/content/2_guides/1_page-builder-with-blade/4_creating-the-page-module.md b/docs/content/2_guides/1_page-builder-with-blade/4_creating-the-page-module.md
index e8616efde..c601d79f3 100644
--- a/docs/content/2_guides/1_page-builder-with-blade/4_creating-the-page-module.md
+++ b/docs/content/2_guides/1_page-builder-with-blade/4_creating-the-page-module.md
@@ -129,7 +129,7 @@ We can see that `Route::module('pages');` has been added to `routes/twill.php`.
This is automatic, because it is simple enough to do.
-The `routes/twill.php` file is a Twill specific list of routes. These routes are protected and loaded specifically for
+The `routes/twill.php` file is a Twill specific list of routes. These routes are protected and loaded specifically for
the CMS.
In standard Laravel there is no `module` method on a `Route` object, this is something Twill provides and it will build
@@ -139,7 +139,7 @@ many routes for your module, these are then used by the cms, controllers and req
The second step, we have to do ourself. So let's open `app/Providers/AppServiceProvider.php`.
-We will not go into detail about what a service provider is, for that you can check the
+We will not go into detail about what a service provider is, for that you can check the
[official documentation](https://laravel.com/docs/10.x/providers).
In our `boot` method we will add the suggested snippet:
@@ -214,14 +214,14 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreatePagesTables extends Migration
+return new class extends Migration
{
public function up()
{
Schema::create('pages', function (Blueprint $table) {
// this will create an id, a "published" column, and soft delete and timestamps columns
createDefaultTableFields($table);
-
+
// add those 2 columns to enable publication timeframe fields
// (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
// $table->timestamp('publish_start_date')->nullable();
@@ -250,7 +250,7 @@ class CreatePagesTables extends Migration
Schema::dropIfExists('page_slugs');
Schema::dropIfExists('pages');
}
-}
+};
```
This file will create the minimum required tables and columns that Twill uses to provide the CMS functionality. Later in
diff --git a/docs/content/2_guides/1_page-builder-with-blade/9_adding-navigation.md b/docs/content/2_guides/1_page-builder-with-blade/9_adding-navigation.md
index 2d5cf2529..88c16e18a 100644
--- a/docs/content/2_guides/1_page-builder-with-blade/9_adding-navigation.md
+++ b/docs/content/2_guides/1_page-builder-with-blade/9_adding-navigation.md
@@ -62,7 +62,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateMenuLinksTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -83,7 +83,7 @@ class CreateMenuLinksTables extends Migration
{
Schema::dropIfExists('menu_links');
}
-}
+};
```
Now you can run the migration: `php artisan migrate`
@@ -223,7 +223,7 @@ use App\Models\MenuLink;
class MenuLinkRepository extends ModuleRepository
{
protected $relatedBrowsers = ['page'];
-
+
use HandleNesting;
public function __construct(MenuLink $model)
@@ -367,7 +367,7 @@ We will change the contents of `resources/views/components/menu.blade.php` to th
```
We add just a minimal amount of styling as we will not spend too much time on that during this guide. But this will
-build a navigation tree that is slightly indented so that you can see the proper structure.
+build a navigation tree that is slightly indented so that you can see the proper structure.
You cannot see it in action yet, for that we have to add the component to the main template file.
@@ -389,7 +389,7 @@ But, for this guide, we will simply open `resources/views/site/page.blade.php` a
+
{!! $item->renderBlocks() !!}
@@ -402,4 +402,3 @@ Wherever you will put `
` it will render the menu. That's useful because
Now that we have pages and a menu, we have one last thing we need to do.
[We need a frontpage](./10_setup-the-frontpage.md)!
-
diff --git a/docs/content/2_guides/json_repeaters/migration.php b/docs/content/2_guides/json_repeaters/migration.php
index b5dfa23d3..ffdc24ede 100644
--- a/docs/content/2_guides/json_repeaters/migration.php
+++ b/docs/content/2_guides/json_repeaters/migration.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateProjectsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -20,4 +20,4 @@ public function down()
{
Schema::dropIfExists('projects');
}
-}
+};
diff --git a/docs/content/2_guides/manage_frontend_user_profiles_from_twill/2021_08_01_204153_create_profiles_tables.php b/docs/content/2_guides/manage_frontend_user_profiles_from_twill/2021_08_01_204153_create_profiles_tables.php
index 0bf3b3757..ddd516d88 100644
--- a/docs/content/2_guides/manage_frontend_user_profiles_from_twill/2021_08_01_204153_create_profiles_tables.php
+++ b/docs/content/2_guides/manage_frontend_user_profiles_from_twill/2021_08_01_204153_create_profiles_tables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateProfilesTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -27,4 +27,4 @@ public function down()
{
Schema::dropIfExists('profiles');
}
-}
+};
diff --git a/docs/content/2_guides/prefill-block-editor-from-template/2021_09_19_131244_create_articles_tables.php b/docs/content/2_guides/prefill-block-editor-from-template/2021_09_19_131244_create_articles_tables.php
index fc7c8fcd6..962843c97 100644
--- a/docs/content/2_guides/prefill-block-editor-from-template/2021_09_19_131244_create_articles_tables.php
+++ b/docs/content/2_guides/prefill-block-editor-from-template/2021_09_19_131244_create_articles_tables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateArticlesTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -31,4 +31,4 @@ public function down()
Schema::dropIfExists('article_slugs');
Schema::dropIfExists('articles');
}
-}
+};
diff --git a/examples/portfolio/database/migrations/2022_04_01_071515_create_projects_tables.php b/examples/portfolio/database/migrations/2022_04_01_071515_create_projects_tables.php
index 5fe3bdc39..286ed5125 100644
--- a/examples/portfolio/database/migrations/2022_04_01_071515_create_projects_tables.php
+++ b/examples/portfolio/database/migrations/2022_04_01_071515_create_projects_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateProjectsTables extends Migration
+return new class extends Migration
{
public function up(): void
{
@@ -34,4 +34,4 @@ public function down(): void
Schema::dropIfExists('project_slugs');
Schema::dropIfExists('projects');
}
-}
+};
diff --git a/examples/portfolio/database/migrations/2022_04_01_071748_create_partners_tables.php b/examples/portfolio/database/migrations/2022_04_01_071748_create_partners_tables.php
index ce252962c..43a144647 100644
--- a/examples/portfolio/database/migrations/2022_04_01_071748_create_partners_tables.php
+++ b/examples/portfolio/database/migrations/2022_04_01_071748_create_partners_tables.php
@@ -6,7 +6,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreatePartnersTables extends Migration
+return new class extends Migration
{
public function up(): void
{
@@ -44,4 +44,4 @@ public function down(): void
Schema::dropIfExists('partner_slugs');
Schema::dropIfExists('partners');
}
-}
+};
diff --git a/examples/portfolio/database/migrations/2022_04_06_070334_create_comments_tables.php b/examples/portfolio/database/migrations/2022_04_06_070334_create_comments_tables.php
index b963b6ced..f44c5bb9c 100644
--- a/examples/portfolio/database/migrations/2022_04_06_070334_create_comments_tables.php
+++ b/examples/portfolio/database/migrations/2022_04_06_070334_create_comments_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateCommentsTables extends Migration
+return new class extends Migration
{
public function up(): void
{
@@ -21,4 +21,4 @@ public function down(): void
{
Schema::dropIfExists('comments');
}
-}
+};
diff --git a/examples/portfolio/database/migrations/2022_05_30_074255_create_links_tables.php b/examples/portfolio/database/migrations/2022_05_30_074255_create_links_tables.php
index beb4de0e9..fb86e5ffe 100644
--- a/examples/portfolio/database/migrations/2022_05_30_074255_create_links_tables.php
+++ b/examples/portfolio/database/migrations/2022_05_30_074255_create_links_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateLinksTables extends Migration
+return new class extends Migration
{
public function up(): void
{
@@ -23,4 +23,4 @@ public function down(): void
{
Schema::dropIfExists('links');
}
-}
+};
diff --git a/examples/tests-browsers/database/migrations/2021_08_10_0001_create_writers_tables_for_browsers.php b/examples/tests-browsers/database/migrations/2021_08_10_0001_create_writers_tables_for_browsers.php
index d6a7e1aac..f21c7ee6a 100644
--- a/examples/tests-browsers/database/migrations/2021_08_10_0001_create_writers_tables_for_browsers.php
+++ b/examples/tests-browsers/database/migrations/2021_08_10_0001_create_writers_tables_for_browsers.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateWritersTablesForBrowsers extends Migration
+return new class extends Migration
{
public function up()
{
@@ -23,4 +23,4 @@ public function down()
Schema::dropIfExists('writer_revisions');
Schema::dropIfExists('writers');
}
-}
+};
diff --git a/examples/tests-browsers/database/migrations/2021_08_10_0002_create_letters_tables_for_browsers.php b/examples/tests-browsers/database/migrations/2021_08_10_0002_create_letters_tables_for_browsers.php
index 693d980a7..7a2d9567a 100644
--- a/examples/tests-browsers/database/migrations/2021_08_10_0002_create_letters_tables_for_browsers.php
+++ b/examples/tests-browsers/database/migrations/2021_08_10_0002_create_letters_tables_for_browsers.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateLettersTablesForBrowsers extends Migration
+return new class extends Migration
{
public function up()
{
@@ -23,4 +23,4 @@ public function down()
Schema::dropIfExists('letter_revisions');
Schema::dropIfExists('letters');
}
-}
+};
diff --git a/examples/tests-browsers/database/migrations/2021_08_10_0003_create_letter_writer_table_for_browsers.php b/examples/tests-browsers/database/migrations/2021_08_10_0003_create_letter_writer_table_for_browsers.php
index ba00654a5..d8dca0446 100644
--- a/examples/tests-browsers/database/migrations/2021_08_10_0003_create_letter_writer_table_for_browsers.php
+++ b/examples/tests-browsers/database/migrations/2021_08_10_0003_create_letter_writer_table_for_browsers.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateLetterWriterTableForBrowsers extends Migration
+return new class extends Migration
{
public function up()
{
@@ -19,4 +19,4 @@ public function down()
{
Schema::dropIfExists('letter_writer');
}
-}
+};
diff --git a/examples/tests-browsers/database/migrations/2021_08_10_0004_create_bios_tables_for_browsers.php b/examples/tests-browsers/database/migrations/2021_08_10_0004_create_bios_tables_for_browsers.php
index ddae868c6..fbe05f284 100644
--- a/examples/tests-browsers/database/migrations/2021_08_10_0004_create_bios_tables_for_browsers.php
+++ b/examples/tests-browsers/database/migrations/2021_08_10_0004_create_bios_tables_for_browsers.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateBiosTablesForBrowsers extends Migration
+return new class extends Migration
{
public function up()
{
@@ -25,4 +25,4 @@ public function down()
Schema::dropIfExists('bio_revisions');
Schema::dropIfExists('bios');
}
-}
+};
diff --git a/examples/tests-browsers/database/migrations/2021_08_10_0005_create_books_tables_for_browsers.php b/examples/tests-browsers/database/migrations/2021_08_10_0005_create_books_tables_for_browsers.php
index e299b6392..a7cfe1113 100644
--- a/examples/tests-browsers/database/migrations/2021_08_10_0005_create_books_tables_for_browsers.php
+++ b/examples/tests-browsers/database/migrations/2021_08_10_0005_create_books_tables_for_browsers.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateBooksTablesForBrowsers extends Migration
+return new class extends Migration
{
public function up()
{
@@ -23,4 +23,4 @@ public function down()
Schema::dropIfExists('book_revisions');
Schema::dropIfExists('books');
}
-}
+};
diff --git a/examples/tests-capsules/app/Twill/Capsules/Homepages/database/migrations/2023_01_02_082723_create_homepages_tables.php b/examples/tests-capsules/app/Twill/Capsules/Homepages/database/migrations/2023_01_02_082723_create_homepages_tables.php
index 5a338b398..db7a694f5 100644
--- a/examples/tests-capsules/app/Twill/Capsules/Homepages/database/migrations/2023_01_02_082723_create_homepages_tables.php
+++ b/examples/tests-capsules/app/Twill/Capsules/Homepages/database/migrations/2023_01_02_082723_create_homepages_tables.php
@@ -4,14 +4,14 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateHomepagesTables extends Migration
+return new class extends Migration
{
public function up()
{
Schema::create('homepages', function (Blueprint $table) {
// this will create an id, a "published" column, and soft delete and timestamps columns
createDefaultTableFields($table);
-
+
// add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
// $table->timestamp('publish_start_date')->nullable();
// $table->timestamp('publish_end_date')->nullable();
@@ -34,4 +34,4 @@ public function down()
Schema::dropIfExists('homepage_translations');
Schema::dropIfExists('homepages');
}
-}
+};
diff --git a/examples/tests-capsules/app/Twill/Capsules/Posts/database/migrations/2020_08_14_205624_create_posts_tables.php b/examples/tests-capsules/app/Twill/Capsules/Posts/database/migrations/2020_08_14_205624_create_posts_tables.php
index 7fa20ae38..3745cb386 100644
--- a/examples/tests-capsules/app/Twill/Capsules/Posts/database/migrations/2020_08_14_205624_create_posts_tables.php
+++ b/examples/tests-capsules/app/Twill/Capsules/Posts/database/migrations/2020_08_14_205624_create_posts_tables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreatePostsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -40,4 +40,4 @@ public function down()
Schema::dropIfExists('post_slugs');
Schema::dropIfExists('posts');
}
-}
+};
diff --git a/examples/tests-deep-nested/database/migrations/2022_11_25_113826_create_clients_tables.php b/examples/tests-deep-nested/database/migrations/2022_11_25_113826_create_clients_tables.php
index fba902deb..78066c01c 100644
--- a/examples/tests-deep-nested/database/migrations/2022_11_25_113826_create_clients_tables.php
+++ b/examples/tests-deep-nested/database/migrations/2022_11_25_113826_create_clients_tables.php
@@ -4,35 +4,29 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateClientsTables extends Migration
+return new class extends Migration
{
public function up()
{
Schema::create('clients', function (Blueprint $table) {
// this will create an id, a "published" column, and soft delete and timestamps columns
createDefaultTableFields($table);
-
+
// feel free to modify the name of this column, but title is supported by default (you would need to specify the name of the column Twill should consider as your "title" column in your module controller if you change it)
$table->string('title', 200)->nullable();
// your generated model and form include a description field, to get you started, but feel free to get rid of it if you don't need it
$table->text('description')->nullable();
-
+
// add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
// $table->timestamp('publish_start_date')->nullable();
// $table->timestamp('publish_end_date')->nullable();
});
-
-
-
-
-
-
}
public function down()
{
-
+
Schema::dropIfExists('clients');
}
-}
+};
diff --git a/examples/tests-deep-nested/database/migrations/2022_11_25_114216_create_client_projects_tables.php b/examples/tests-deep-nested/database/migrations/2022_11_25_114216_create_client_projects_tables.php
index 47d9beac1..08841fd4b 100644
--- a/examples/tests-deep-nested/database/migrations/2022_11_25_114216_create_client_projects_tables.php
+++ b/examples/tests-deep-nested/database/migrations/2022_11_25_114216_create_client_projects_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateClientProjectsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -36,4 +36,4 @@ public function down()
Schema::dropIfExists('client_projects');
}
-}
+};
diff --git a/examples/tests-deep-nested/database/migrations/2022_11_25_114233_create_client_project_applications_tables.php b/examples/tests-deep-nested/database/migrations/2022_11_25_114233_create_client_project_applications_tables.php
index d437a8ae0..76d7efc28 100644
--- a/examples/tests-deep-nested/database/migrations/2022_11_25_114233_create_client_project_applications_tables.php
+++ b/examples/tests-deep-nested/database/migrations/2022_11_25_114233_create_client_project_applications_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateClientProjectApplicationsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -23,17 +23,10 @@ public function up()
// $table->timestamp('publish_start_date')->nullable();
// $table->timestamp('publish_end_date')->nullable();
});
-
-
-
-
-
-
}
public function down()
{
-
Schema::dropIfExists('client_project_applications');
}
-}
+};
diff --git a/examples/tests-modules/database/migrations/2021_10_17_174613_create_categories_tables.php b/examples/tests-modules/database/migrations/2021_10_17_174613_create_categories_tables.php
index 4079f165f..70d0c8190 100644
--- a/examples/tests-modules/database/migrations/2021_10_17_174613_create_categories_tables.php
+++ b/examples/tests-modules/database/migrations/2021_10_17_174613_create_categories_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreateCategoriesTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -54,4 +54,4 @@ public function down()
Schema::dropIfExists('categories');
}
-}
+};
diff --git a/examples/tests-modules/database/migrations/2021_10_18_193753_create_authors_tables.php b/examples/tests-modules/database/migrations/2021_10_18_193753_create_authors_tables.php
index 66c498b68..a445889c9 100644
--- a/examples/tests-modules/database/migrations/2021_10_18_193753_create_authors_tables.php
+++ b/examples/tests-modules/database/migrations/2021_10_18_193753_create_authors_tables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreateAuthorsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -75,4 +75,4 @@ public function down()
Schema::dropIfExists('authors');
}
-}
+};
diff --git a/examples/tests-modules/database/migrations/2022_05_25_083741_create_revision_limited_contents_tables.php b/examples/tests-modules/database/migrations/2022_05_25_083741_create_revision_limited_contents_tables.php
index b2189636f..280bdede4 100644
--- a/examples/tests-modules/database/migrations/2022_05_25_083741_create_revision_limited_contents_tables.php
+++ b/examples/tests-modules/database/migrations/2022_05_25_083741_create_revision_limited_contents_tables.php
@@ -4,20 +4,20 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateRevisionLimitedContentsTables extends Migration
+return new class extends Migration
{
public function up()
{
Schema::create('revision_limiteds', function (Blueprint $table) {
// this will create an id, a "published" column, and soft delete and timestamps columns
createDefaultTableFields($table);
-
+
// feel free to modify the name of this column, but title is supported by default (you would need to specify the name of the column Twill should consider as your "title" column in your module controller if you change it)
$table->string('title', 200)->nullable();
// your generated model and form include a description field, to get you started, but feel free to get rid of it if you don't need it
$table->text('description')->nullable();
-
+
// add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
// $table->timestamp('publish_start_date')->nullable();
// $table->timestamp('publish_end_date')->nullable();
@@ -33,4 +33,4 @@ public function down()
Schema::dropIfExists('revision_limited_revisions');
Schema::dropIfExists('revision_limited');
}
-}
+};
diff --git a/examples/tests-nestedmodules/database/migrations/2021_09_16_230238_create_nodes_tables.php b/examples/tests-nestedmodules/database/migrations/2021_09_16_230238_create_nodes_tables.php
index da96b095e..c28fc42bd 100644
--- a/examples/tests-nestedmodules/database/migrations/2021_09_16_230238_create_nodes_tables.php
+++ b/examples/tests-nestedmodules/database/migrations/2021_09_16_230238_create_nodes_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateNodesTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -25,4 +25,4 @@ public function down()
{
Schema::dropIfExists('nodes');
}
-}
+};
diff --git a/examples/tests-permissions/database/migrations/2021_07_20_132405_create_postings_tables.php b/examples/tests-permissions/database/migrations/2021_07_20_132405_create_postings_tables.php
index c7932f527..e6352e6ba 100644
--- a/examples/tests-permissions/database/migrations/2021_07_20_132405_create_postings_tables.php
+++ b/examples/tests-permissions/database/migrations/2021_07_20_132405_create_postings_tables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class CreatePostingsTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -18,4 +18,4 @@ public function down()
{
Schema::dropIfExists('postings');
}
-}
+};
diff --git a/examples/tests-singleton/database/migrations/2021_09_30_202102_create_contact_pages_tables.php b/examples/tests-singleton/database/migrations/2021_09_30_202102_create_contact_pages_tables.php
index 6718170fc..128057f9f 100644
--- a/examples/tests-singleton/database/migrations/2021_09_30_202102_create_contact_pages_tables.php
+++ b/examples/tests-singleton/database/migrations/2021_09_30_202102_create_contact_pages_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateContactPagesTables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -34,4 +34,4 @@ public function down()
Schema::dropIfExists('contact_page_slugs');
Schema::dropIfExists('contact_pages');
}
-}
+};
diff --git a/examples/tests-subdomain-routing/database/migrations/2022_08_17_112843_create_pages_tables.php b/examples/tests-subdomain-routing/database/migrations/2022_08_17_112843_create_pages_tables.php
index bb875ef3d..c59238cfc 100644
--- a/examples/tests-subdomain-routing/database/migrations/2022_08_17_112843_create_pages_tables.php
+++ b/examples/tests-subdomain-routing/database/migrations/2022_08_17_112843_create_pages_tables.php
@@ -4,16 +4,16 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreatePagesTables extends Migration
+return new class extends Migration
{
public function up()
{
Schema::create('pages', function (Blueprint $table) {
// this will create an id, a "published" column, and soft delete and timestamps columns
createDefaultTableFields($table);
-
+
$table->integer('position')->unsigned()->nullable();
-
+
// add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
// $table->timestamp('publish_start_date')->nullable();
// $table->timestamp('publish_end_date')->nullable();
@@ -41,4 +41,4 @@ public function down()
Schema::dropIfExists('page_slugs');
Schema::dropIfExists('pages');
}
-}
+};
diff --git a/migrations/default/2020_02_09_000001_create_twill_default_users_tables.php b/migrations/default/2020_02_09_000001_create_twill_default_users_tables.php
index f0599afa8..878bb34b2 100644
--- a/migrations/default/2020_02_09_000001_create_twill_default_users_tables.php
+++ b/migrations/default/2020_02_09_000001_create_twill_default_users_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultUsersTables extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -49,4 +49,4 @@ public function down()
Schema::dropIfExists(config('twill.password_resets_table', 'twill_password_resets'));
Schema::dropIfExists(config('twill.users_table', 'twill_users'));
}
-}
+};
diff --git a/migrations/default/2020_02_09_000002_create_twill_default_blocks_table.php b/migrations/default/2020_02_09_000002_create_twill_default_blocks_table.php
index 02fdb3980..c408fbe8a 100644
--- a/migrations/default/2020_02_09_000002_create_twill_default_blocks_table.php
+++ b/migrations/default/2020_02_09_000002_create_twill_default_blocks_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultBlocksTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -41,4 +41,4 @@ public function down()
Schema::dropIfExists($twillBlocksTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000003_create_twill_default_medias_tables.php b/migrations/default/2020_02_09_000003_create_twill_default_medias_tables.php
index b4b1d00ab..eb41ce1e4 100644
--- a/migrations/default/2020_02_09_000003_create_twill_default_medias_tables.php
+++ b/migrations/default/2020_02_09_000003_create_twill_default_medias_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultMediasTables extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -66,4 +66,4 @@ public function down()
Schema::dropIfExists($twillMediablesTable);
Schema::dropIfExists($twillMediasTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000004_create_twill_default_files_tables.php b/migrations/default/2020_02_09_000004_create_twill_default_files_tables.php
index 0d9e60a7e..144b4efdc 100644
--- a/migrations/default/2020_02_09_000004_create_twill_default_files_tables.php
+++ b/migrations/default/2020_02_09_000004_create_twill_default_files_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultFilesTables extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -56,4 +56,4 @@ public function down()
Schema::dropIfExists($twillFileablesTable);
Schema::dropIfExists($twillFilesTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000005_create_twill_default_settings_table.php b/migrations/default/2020_02_09_000005_create_twill_default_settings_table.php
index 0b4686db5..240968096 100644
--- a/migrations/default/2020_02_09_000005_create_twill_default_settings_table.php
+++ b/migrations/default/2020_02_09_000005_create_twill_default_settings_table.php
@@ -5,7 +5,7 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
-class CreateTwillDefaultSettingsTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -46,4 +46,4 @@ public function down()
Schema::dropIfExists(Str::singular($twillSettingsTable) . '_translations');
Schema::dropIfExists($twillSettingsTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000006_create_twill_default_tags_tables.php b/migrations/default/2020_02_09_000006_create_twill_default_tags_tables.php
index 19fb3fe4e..215eeca2e 100644
--- a/migrations/default/2020_02_09_000006_create_twill_default_tags_tables.php
+++ b/migrations/default/2020_02_09_000006_create_twill_default_tags_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultTagsTables extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -49,4 +49,4 @@ public function down()
Schema::dropIfExists(config('twill.tags_table', 'twill_tags'));
Schema::dropIfExists(config('twill.tagged_table', 'twill_tagged'));
}
-}
+};
diff --git a/migrations/default/2020_02_09_000007_create_twill_default_activity_log_table.php b/migrations/default/2020_02_09_000007_create_twill_default_activity_log_table.php
index f729eccdf..139bed699 100644
--- a/migrations/default/2020_02_09_000007_create_twill_default_activity_log_table.php
+++ b/migrations/default/2020_02_09_000007_create_twill_default_activity_log_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultActivityLogTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -35,4 +35,4 @@ public function down()
{
Schema::dropIfExists(config('activitylog.table_name'));
}
-}
+};
diff --git a/migrations/default/2020_02_09_000008_create_twill_default_features_table.php b/migrations/default/2020_02_09_000008_create_twill_default_features_table.php
index cdc9f0f01..457e15170 100644
--- a/migrations/default/2020_02_09_000008_create_twill_default_features_table.php
+++ b/migrations/default/2020_02_09_000008_create_twill_default_features_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultFeaturesTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -40,4 +40,4 @@ public function down()
Schema::dropIfExists($twillFeaturesTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000010_create_twill_default_related_table.php b/migrations/default/2020_02_09_000010_create_twill_default_related_table.php
index 6d249d0f4..a45b23fde 100644
--- a/migrations/default/2020_02_09_000010_create_twill_default_related_table.php
+++ b/migrations/default/2020_02_09_000010_create_twill_default_related_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultRelatedTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -44,4 +44,4 @@ public function down()
Schema::dropIfExists($twillRelatedTable);
}
-}
+};
diff --git a/migrations/default/2020_02_09_000011_add_locale_column_to_twill_default-mediables.php b/migrations/default/2020_02_09_000011_add_locale_column_to_twill_default-mediables.php
index 408004056..93988c03d 100644
--- a/migrations/default/2020_02_09_000011_add_locale_column_to_twill_default-mediables.php
+++ b/migrations/default/2020_02_09_000011_add_locale_column_to_twill_default-mediables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class AddLocaleColumnToTwillDefaultMediables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -30,4 +30,4 @@ public function getCurrentLocale()
{
return getLocales()[0] ?? config('app.locale');
}
-}
+};
diff --git a/migrations/default/2020_02_09_000012_change_locale_column_in_twill_default_fileables.php b/migrations/default/2020_02_09_000012_change_locale_column_in_twill_default_fileables.php
index 37abf0a28..ade01a0d1 100644
--- a/migrations/default/2020_02_09_000012_change_locale_column_in_twill_default_fileables.php
+++ b/migrations/default/2020_02_09_000012_change_locale_column_in_twill_default_fileables.php
@@ -3,7 +3,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-class ChangeLocaleColumnInTwillDefaultFileables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -22,4 +22,4 @@ public function down()
});
}
}
-}
+};
diff --git a/migrations/default/2020_02_09_000013_add_language_column_to_twill_default_users.php b/migrations/default/2020_02_09_000013_add_language_column_to_twill_default_users.php
index d49393549..0ec07311d 100644
--- a/migrations/default/2020_02_09_000013_add_language_column_to_twill_default_users.php
+++ b/migrations/default/2020_02_09_000013_add_language_column_to_twill_default_users.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddLanguageColumnToTwillDefaultUsers extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -37,4 +37,4 @@ public function down()
});
}
}
-}
+};
diff --git a/migrations/default/2020_02_09_000014_add_editor_name_column_to_blocks_table.php b/migrations/default/2020_02_09_000014_add_editor_name_column_to_blocks_table.php
index fadefe0bd..c2140cb2a 100644
--- a/migrations/default/2020_02_09_000014_add_editor_name_column_to_blocks_table.php
+++ b/migrations/default/2020_02_09_000014_add_editor_name_column_to_blocks_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddEditorNameColumnToBlocksTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -37,4 +37,4 @@ public function down()
});
}
}
-}
+};
diff --git a/migrations/default/2021_07_08_000001_update_twill_default_users_table.php b/migrations/default/2021_07_08_000001_update_twill_default_users_table.php
index ea4f422dd..4835cf857 100644
--- a/migrations/default/2021_07_08_000001_update_twill_default_users_table.php
+++ b/migrations/default/2021_07_08_000001_update_twill_default_users_table.php
@@ -5,7 +5,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class UpdateTwillDefaultUsersTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -57,4 +57,4 @@ private function seedNewFields()
}
});
}
-}
+};
diff --git a/migrations/default/2022_01_25_000015_add_columns_to_activity_log_table.php b/migrations/default/2022_01_25_000015_add_columns_to_activity_log_table.php
index d501a6af3..a6c90ef7b 100644
--- a/migrations/default/2022_01_25_000015_add_columns_to_activity_log_table.php
+++ b/migrations/default/2022_01_25_000015_add_columns_to_activity_log_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddColumnsToActivityLogTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -57,4 +57,4 @@ function (Blueprint $table) use ($connection, $tableName) {
);
}
}
-}
+};
diff --git a/migrations/default/2022_04_05_000015_update_activity_log_morph_size.php b/migrations/default/2022_04_05_000015_update_activity_log_morph_size.php
index cb34cb898..cfedb66ca 100644
--- a/migrations/default/2022_04_05_000015_update_activity_log_morph_size.php
+++ b/migrations/default/2022_04_05_000015_update_activity_log_morph_size.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class UpdateActivityLogMorphSize extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -57,4 +57,4 @@ function (Blueprint $table) use ($connection, $tableName) {
);
}
}
-}
+};
diff --git a/migrations/default/2022_08_29_110837_create_app_settings_tables.php b/migrations/default/2022_08_29_110837_create_app_settings_tables.php
index 487cc219e..3b8aa2a52 100644
--- a/migrations/default/2022_08_29_110837_create_app_settings_tables.php
+++ b/migrations/default/2022_08_29_110837_create_app_settings_tables.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-return new class() extends Migration {
+return new class extends Migration {
public function up(): void
{
Schema::create('app_settings', function (Blueprint $table) {
diff --git a/migrations/optional/permissions-management/2020_04_20_000001_support_permission.php b/migrations/optional/permissions-management/2020_04_20_000001_support_permission.php
index bc4048a8e..9f1916c10 100644
--- a/migrations/optional/permissions-management/2020_04_20_000001_support_permission.php
+++ b/migrations/optional/permissions-management/2020_04_20_000001_support_permission.php
@@ -7,7 +7,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class SupportPermission extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -188,4 +188,4 @@ private function seedDefaultGroup()
$everyoneGroup->is_everyone_group = true;
$everyoneGroup->save();
}
-}
+};
diff --git a/migrations/optional/permissions-management/2020_06_17_000002_add_subdomains_access_column_to_groups_table.php b/migrations/optional/permissions-management/2020_06_17_000002_add_subdomains_access_column_to_groups_table.php
index 32df5eea3..61d979ff6 100644
--- a/migrations/optional/permissions-management/2020_06_17_000002_add_subdomains_access_column_to_groups_table.php
+++ b/migrations/optional/permissions-management/2020_06_17_000002_add_subdomains_access_column_to_groups_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddSubdomainsAccessColumnToGroupsTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -33,4 +33,4 @@ public function down()
});
}
}
-}
+};
diff --git a/migrations/optional/permissions-management/2021_07_08_000002_update_twill_users_role_fields.php b/migrations/optional/permissions-management/2021_07_08_000002_update_twill_users_role_fields.php
index 7ea2120ae..da7466d4d 100644
--- a/migrations/optional/permissions-management/2021_07_08_000002_update_twill_users_role_fields.php
+++ b/migrations/optional/permissions-management/2021_07_08_000002_update_twill_users_role_fields.php
@@ -7,7 +7,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class UpdateTwillUsersRoleFields extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -113,4 +113,4 @@ private function revertNewRoles()
}
});
}
-}
+};
diff --git a/migrations/optional/users-2fa/2020_02_09_000013_add_two_factor_auth_columns_to_twill_default_users.php b/migrations/optional/users-2fa/2020_02_09_000013_add_two_factor_auth_columns_to_twill_default_users.php
index 513d25008..6b21ec585 100644
--- a/migrations/optional/users-2fa/2020_02_09_000013_add_two_factor_auth_columns_to_twill_default_users.php
+++ b/migrations/optional/users-2fa/2020_02_09_000013_add_two_factor_auth_columns_to_twill_default_users.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class AddTwoFactorAuthColumnsToTwillDefaultUsers extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -53,4 +53,4 @@ public function down()
}
}
-}
+};
diff --git a/migrations/optional/users-oauth/2020_02_09_000014_create_twill_default_users_oauth_table.php b/migrations/optional/users-oauth/2020_02_09_000014_create_twill_default_users_oauth_table.php
index e3a0f9e75..08a56dc79 100644
--- a/migrations/optional/users-oauth/2020_02_09_000014_create_twill_default_users_oauth_table.php
+++ b/migrations/optional/users-oauth/2020_02_09_000014_create_twill_default_users_oauth_table.php
@@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class CreateTwillDefaultUsersOauthTable extends Migration
+return new class extends Migration
{
/**
* Run the migrations.
@@ -41,4 +41,4 @@ public function down()
{
Schema::dropIfExists(config('twill.users_oauth_table', 'twill_users_oauth'));
}
-}
+};
diff --git a/src/Commands/ModuleMake.php b/src/Commands/ModuleMake.php
index d094163d1..783cdc06c 100644
--- a/src/Commands/ModuleMake.php
+++ b/src/Commands/ModuleMake.php
@@ -481,7 +481,6 @@ private function box(string $content): void
private function createMigration($moduleName = 'items')
{
$table = Str::snake($moduleName);
- $tableClassName = Str::studly($table);
$migrationName = 'create_' . $table . '_tables';
@@ -493,8 +492,8 @@ private function createMigration($moduleName = 'items')
$fullPath = $this->laravel['migration.creator']->create($migrationName, $migrationPath);
$stub = str_replace(
- ['{{table}}', '{{singularTableName}}', '{{tableClassName}}'],
- [$table, Str::singular($table), $tableClassName],
+ ['{{table}}', '{{singularTableName}}'],
+ [$table, Str::singular($table)],
$this->files->get(__DIR__ . '/stubs/migration.stub')
);
diff --git a/src/Commands/stubs/migration.stub b/src/Commands/stubs/migration.stub
index d4cbf81fd..201b05ca2 100644
--- a/src/Commands/stubs/migration.stub
+++ b/src/Commands/stubs/migration.stub
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
-class Create{{tableClassName}}Tables extends Migration
+return new class extends Migration
{
public function up()
{
@@ -50,4 +50,4 @@ class Create{{tableClassName}}Tables extends Migration
Schema::dropIfExists('{{singularTableName}}_slugs');{{/hasSlug}}
Schema::dropIfExists('{{table}}');
}
-}
+};
diff --git a/tests/integration/Capsules/CapsulesTest.php b/tests/integration/Capsules/CapsulesTest.php
index 5b95c5133..2982bb083 100644
--- a/tests/integration/Capsules/CapsulesTest.php
+++ b/tests/integration/Capsules/CapsulesTest.php
@@ -262,11 +262,10 @@ public function makeCapsule()
public function selectCapsule()
{
foreach ($this->capsules as $capsule) {
- $class = Str::studly($capsule);
+ $migrationDeclared = collect(get_declared_classes())
+ ->contains(fn($class) => Str::contains($class, "create_{$capsule}_tables"));
- $class = "Create{$class}Tables";
-
- if (! collect(get_declared_classes())->contains($class)) {
+ if (! $migrationDeclared) {
$this->capsuleName = $capsule;
break;