1if (Schema::hasColumn('users', 'phone')) {
2 Schema::table('users', function (Blueprint $table){
3 $table->dropColumn('phone');
4 });
5}
1// You may check for the existence of a table or column
2// using the hasTable and hasColumn methods:
3
4if (Schema::hasTable('users')) {
5 // The "users" table exists...
6}
7
8if (Schema::hasColumn('users', 'email')) {
9 // The "users" table exists and has an "email" column...
10}
1if (Schema::hasTable('users')) {
2 // The "users" table exists...
3}
4
5if (Schema::hasColumn('users', 'email')) {
6 // The "users" table exists and has an "email" column...
7}