Answers for "remove table from database laravel"

PHP
1

php artisan drop table

php artisan make:migration drop_name_table
Posted by: Guest on February-22-2021
1

laravel db drop table

//Get all the table names
$all_table_names = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames();

foreach ($all_table_names as $name) {
    //if you don't want to truncate migrations in Database
    if ($name == 'migrations') {
        continue;
    }
    DB::table($name)->truncate();
}
Posted by: Guest on January-08-2022

Code answers related to "remove table from database laravel"

Browse Popular Code Answers by Language