Delete all the tables in database in one shot

Why not use this:

Artisan::call('migrate:reset', ['--force' => true]);

You can also use migrate:fresh in newer Laravel versions.

The migrate:fresh command will drop all tables from the database and then execute the migrate command

https://laravel.com/docs/7.x/migrations


php artisan db:wipe

It is a quick way to drop all the tables, their types and views if you’re using Laravel 6.x

Full description:

$ php artisan db:wipe {--database=} {--drop-views} {--drop-types} {--force}
  • database - The database connection to use
  • drop-views - Drop all tables and views
  • drop-types - Drop all tables and types (Postgres only)
  • force - Force the operation to run when in production

It was implemented on Aug 20, 2019

This change has also affected the db:fresh command’s functionality internally. Now it just calls db:wipe and then migrate.

Tags:

Laravel 5