Answers for "laravel create new column in table"

PHP
24

add new column in laravel migration

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
Posted by: Guest on September-03-2020
2

add new column in laravel migration

Schema::table('table_name', function (Blueprint $table) {
            $table->string('column_name', 255)->nullable()->after('previous_column_name');
        });
Posted by: Guest on September-29-2020
0

add new column in existing table in laravel migration

public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}
Posted by: Guest on August-19-2020

Code answers related to "laravel create new column in table"

Browse Popular Code Answers by Language