Answers for "drop column table in migration if exist in laravel"

PHP
2

laravel drop column if exists

if (Schema::hasColumn('users', 'phone')) {
 	Schema::table('users', function (Blueprint $table){
       $table->dropColumn('phone');
    });
}
Posted by: Guest on November-13-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
2

laravel drop column if exists

Schema::table('users', function (Blueprint $table) {
     $table->dropColumn('name');
});
Posted by: Guest on September-17-2020

Code answers related to "drop column table in migration if exist in laravel"

Browse Popular Code Answers by Language