Dropping Multiple Columns in a Single Line of Laravel Migration

Database

Committed to the LaraBrain by: wjgilmore (@wjgilmore) at November 5, 2015 11:21 am

Save yourself a few keystrokes by dropping multiple columns in a single dropColumn statement

A Laravel migration's down method is used to undo any changes made in the corresponding up method. For instance if you add a few columns to a table in the up method, you'll want to make sure those columns are removed, or dropped, in the down method. You can save a few keystrokes by dropping multiple columns in a single dropColumn method like so:

$table->dropColumn(
  'onetime_url', 'auth_key'
);