Group Columns within an After Method

In your migrations, you can add multiple columns after another column using the after method:

1Schema::table('users', function (Blueprint $table) {
2 $table->after('password', function ($table) {
3 $table->string('address_line1');
4 $table->string('address_line2');
5 $table->string('city');
6 });
7});

Tip given by @ncosmeescobedo

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord