Support after() on morphs() Columns #55285
-
Currently, when using Developers often work around this by manually defining both columns with It would be great if Schema::table('posts', function (Blueprint $table) {
$table->morphs('commentable'); // Cannot use the after() method and other modifiers
});
Schema::table('posts', function (Blueprint $table) {
$table->unsignedInteger('commentable_id')->after('title');
$table->string('commentable_type')->after('commentable_id');// Can use the after() method and other modifiers
$table->index(['commentable_id', 'commentable_type']);
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You may try this https://laravel.com/docs/12.x/migrations#column-order $table->after('title', function (Blueprint $table) {
$table->morphs('commentable');
}); |
Beta Was this translation helpful? Give feedback.
You may try this https://laravel.com/docs/12.x/migrations#column-order