xxxxxxxxxx
Schema::disableForeignKeyConstraints();
xxxxxxxxxx
foreach ($tableNames as $name) {
//if you don't want to truncate migrations
if ($name == 'migrations') {
continue;
}
DB::table($name)->truncate();
}
xxxxxxxxxx
$tableNames = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();