“Adicionar nova coluna na migração de Laravel” Respostas de código

Adicionar nova coluna na migração de Laravel

php artisan make:migration add_paid_to_users_table --table=users
  
public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('paid');
    });
}

php artisan migrate
Indian Gooner

Adicionar coluna em Laravel Migration CMND

php artisan make:migration add_paid_to_users_table --table=users
9jadev

Adicione outro campo na migração existente Laravel

php artisan make:migration add_paid_to_users_table --table=users
Blushing Bear

Migração de Laravel Adicionar coluna depois

Schema::table('users', function ($table) {
    $table->string('email')->after('id')->nullable();
});
Courageous Cod

Adicione nova coluna à tabela Laravel

php artisan make:migration add_paid_to_users_table --table=users
  
public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid')->after('status');
    });
}

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn('paid');
    });
}

php artisan migrate
Noob Learner

Adicionar nova coluna na migração de Laravel

Schema::table('table_name', function (Blueprint $table) {
            $table->string('column_name', 255)->nullable()->after('previous_column_name');
        });
Super Starling

Respostas semelhantes a “Adicionar nova coluna na migração de Laravel”

Perguntas semelhantes a “Adicionar nova coluna na migração de Laravel”

Procure respostas de código populares por idioma

Procurar outros idiomas de código