confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) { $tables = DB::connection()->getDoctrineSchemaManager()->listTableNames(); $except_tables = [ 'oauth_access_tokens', 'oauth_clients', 'oauth_personal_access_clients', 'migrations', 'settings', 'users', ]; foreach ($tables as $table) { $this->info($table); if (in_array($table, $except_tables)) { $this->info('Table '. $table. ' will be skipped'); } else { \DB::statement('delete from '.$table); } } \DB::statement('delete from users WHERE id > 2'); \DB::statement('delete from oauth_clients WHERE id > 2'); \DB::statement('delete from oauth_access_tokens WHERE id > 2'); } } }