/**
  * Install Database Tables
  */
 public function installTables($reset = false)
 {
     //	Check Reset
     if ($reset) {
         //	Reset Data
         Schema::dropIfExists($this->table_modules);
         Schema::dropIfExists($this->table_module_versions);
     }
     //	Check Table Already Exists
     if (!Schema::hasTable($this->table_module_versions)) {
         //	Install Table
         Schema::create($this->table_module_versions, function ($table) {
             $table->increments('id');
             $table->string("name");
             $table->string("version");
             $table->timestamp('installed_on');
         });
     }
     //	Check Table Already Exists
     if (!Schema::hasTable($this->table_modules)) {
         //	Install Table
         Schema::create($this->table_modules, function ($table) {
             $table->increments('id');
             $table->string("module");
             $table->string("version");
             $table->string("name");
             $table->string("description");
             $table->text("path");
             $table->text('depends_on');
             $table->text('meta_data');
             $table->integer("is_package")->default(0);
             $table->integer("order_index");
             $table->integer("enabled")->default(0);
             $table->integer("locked")->default(0);
             $table->timestamps();
         });
     }
     //	Set Existing Database Version
     ModuleVersionItem::versionInstalled("__system__", $this->db_version);
 }
 /**
  * Undo Module Migrations
  */
 public function undoMigrations($version)
 {
     //  Check Migrations Exists
     if ($this->hasMigrations()) {
         //  Get Migration Files
         $migrations = $this->app["files"]->files($this->modulePath("migrations"));
         //  Reverse List
         $migrations = array_reverse($migrations);
         //  Loop Each Migration
         foreach ($migrations as $migration) {
             //  Load the File
             require_once $migration;
             //  Detect Class Name
             $mClass = $this->resolveMigrationClassName($migration);
             //  Check Class Name
             if ($mClass) {
                 //  Create Instance
                 $ins = new $mClass();
                 //  Undo Migration
                 $ins->down();
             }
         }
         //  Remove Version Log
         ModuleVersionItem::removeVersionLog($this->name . "::migrate", $version);
     }
 }