“Laravel Change Type” Respostas de código

Laravel Key estrangeiro

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Courageous Cod

Laravel Change Type

php artisan make:migration change_sometable_in_finance_table --table=finance

public function up()
{
    Schema::table('sometable', function (Blueprint $table) {
        $table->text('text')->change();
    });
}
Excited Echidna

coluna Laravel Drop

// To drop a column, use the dropColumn method on the schema builder.
// Before dropping columns from a SQLite database, you will need to add
// the doctrine/dbal dependency to your composer.json file and run the
// composer update command in your terminal to install the library:

Schema::table('users', function (Blueprint $table) {
    $table->dropColumn('votes');
});
Yingfufu

coluna de mudança de laravel

Schema::table('users', function (Blueprint $table) {
    $table->string('name', 50)->nullable()->change();
});
Alberto Peripolli

Laravel Migration Change Coluna Tipo

public function up()
{
    Schema::table('sometable', function (Blueprint $table) {
        $table->text('text')->change();
    });
}
hmt

migrações necessárias em campo Laravel

$table->string('foo')->nullable(false)->change();
r00ster

Respostas semelhantes a “Laravel Change Type”

Perguntas semelhantes a “Laravel Change Type”

Mais respostas relacionadas para “Laravel Change Type” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código