Esempio n. 1
0
 public function handle()
 {
     $modelRoot = $this->argument("modelRoot");
     $this->info("Destroying Generated Migration Files and Tables");
     $class = $this->argument("class");
     if (!$class) {
         $classes = \Config::get('app.buildmodels');
         if ($classes && is_array($classes) && count($classes)) {
             foreach ($classes as $class) {
                 $this->info("Deleting Migrations for: [{$class}]");
                 $class::deleteMigrationFiles();
                 $this->info("Migration deletion for [{$class}] done");
                 $this->info("Dropping table for: [{$class}]");
                 $class::dropTable();
                 $this->info("Table dropped for [{$class}]");
             }
             #If all classes, drop the Migrations, session & password tables, too.
             $this->info("Model drops/deletions completed; now the rest:");
             $systables = ['migrations', 'password_resets', 'sessions'];
             foreach ($systables as $systable) {
                 $this->info("Dropping {$systable}...");
                 PkModel::dropTable($systable);
             }
         } else {
             $this->info("No Models to delete for!");
             die;
         }
     } else {
         $migratontobuild = $modelRoot . '\\' . $class;
         $this->info("Starting migration build for: [{$migratontobuild}]");
         $migratontobuild::buildMigrationDefinition();
         $this->info("Migration building for [{$migratontobuild}] done");
     }
 }