Answers for "remove column from existing table in laravel migration"

PHP
13

laravel migration remove column

public function up()
{
  Schema::table('table', function($table) {
    $table->dropColumn('column_name');
  });
}
Posted by: Guest on April-16-2020
1

drop column table in migration if exist in laravel

Schema::table('users', function (Blueprint $table) {
     if (Schema::hasColumn('users', 'phone')) {
              $table->dropColumn('phone');
		}
});
Posted by: Guest on August-04-2021

Code answers related to "remove column from existing table in laravel migration"

Browse Popular Code Answers by Language