@dedrick
To drop a column from a database table in a Laravel migration, you can use the dropColumn
method provided by Laravel's schema builder. Here's an example:
1 2 3 4 5 6 |
public function up() { Schema::table('table_name', function ($table) { $table->dropColumn('column_name'); }); } |
In the above example, replace table_name
with the name of the table that you want to modify and column_name
with the name of the column that you want to drop.
If you want to drop multiple columns, you can pass an array of column names to the dropColumn
method:
1 2 3 4 5 6 |
public function up() { Schema::table('table_name', function ($table) { $table->dropColumn(['column1', 'column2']); }); } |
Remember to always run php artisan migrate
after making changes to a migration file.