table tronquée Laravel éloquent
MyModel::truncate();
Stormy Scarab
MyModel::truncate();
foreach ($tableNames as $name) {
//if you don't want to truncate migrations
if ($name == 'migrations') {
continue;
}
DB::table($name)->truncate();
}
Visitor::query()->truncate();
$tableNames = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();
Schema::disableForeignKeyConstraints();
Schema::enableForeignKeyConstraints();