Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Allow adding multiple columns after a column #36145

Closed
wants to merge 2 commits into from

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Feb 4, 2021

This PR allows:

Schema::table('users', function (Blueprint $table) {
    $table->after('remember_token', function ($table){
        $table->string('card_brand')->nullable();
        $table->string('card_last_four', 4)->nullable();
    });
});

The order of the columns will be:

  • remember_token
  • card_brand
  • card_last_four

@taylorotwell
Copy link
Member

Merged.

@ronssij
Copy link

ronssij commented Mar 4, 2021

This is a nice example implementing for assigning multiple nullable columns like this one.

Schema::table('users', function (Blueprint $table) {
   $table->nullable(function ($table){
      $table->string('lastname');
      $table->after('remember_token', function ($table){
          $table->string('card_brand');
          $table->string('card_last_four', 4);
      });
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants