“Laravel DB Drop Table” Kode Jawaban

Rollback migrasi Laravel

To rollback one step:

php artisan migrate:rollback

To rollback multiple steps:

php artisan migrate:rollback --step=[x]
  
To drop all tables and reload all migrations:

php artisan migrate:fresh
Angry Albatross

Tabel Drop Artisan PHP

php artisan make:migration drop_name_table
Super Starling

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();
}
Innocent Ibis

migrasi tabel drop laravel

Schema::drop('users');

Schema::dropIfExists('users');
Alberto Peripolli

Laravel DB Drop Table

foreach(\DB::select('SHOW TABLES') as $table) {
    $all_table_names = get_object_vars($table);
    \Schema::drop($all_table_names[key($all_table_names)]);
}
Innocent Ibis

Jawaban yang mirip dengan “Laravel DB Drop Table”

Pertanyaan yang mirip dengan “Laravel DB Drop Table”

Lebih banyak jawaban terkait untuk “Laravel DB Drop Table” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya