Schema::table('posts', function (Blueprint $table) {
$table->dropForeign(['category_id']);
});
public function down()
{
Schema::table('tarefas', function (Blueprint $table) {
$table->dropForeign('tarefas_user_id_foreign');
$table->dropColumn('user_id');
});
}
Schema::table('table_name', function (Blueprint $table) {
$table->dropForeign(['foreign_key']);
$table->dropColumn('column_key');
});
PS: usually foreign_key = column_key
ex:
Schema::table('despatch_discrepancies', function (Blueprint $table) {
$table->dropForeign(['pick_detail_id']);
$table->dropColumn('pick_detail_id');
});
$table->dropForeign('posts_user_id_foreign');
// Primary table name, from Schema::table(<table>)
// Primary column, from $table->foreign(<column>)
$table->dropForeign('<table>_<column>_foreign');
DB::statement("SET foreign_key_checks=0");
Model::truncate();
DB::statement("SET foreign_key_checks=1");