Caffeinated\Modules\Console\Commands\ModuleMigrateResetCommand::runDown PHP Method

runDown() protected method

Run "down" a migration instance.
protected runDown ( string $slug, object $migration, boolean $pretend )
$slug string
$migration object
$pretend boolean
    protected function runDown($slug, $migration, $pretend)
    {
        $migrationPath = $this->getMigrationPath($slug);
        $file = explode('/', $migration);
        $file = end($file);
        $classFile = implode('_', array_slice(explode('_', basename($migration, '.php')), 4));
        $class = studly_case($classFile);
        $table = $this->laravel['config']['database.migrations'];
        include $migration;
        $instance = new $class();
        $instance->down();
        $this->laravel['db']->table($table)->where('migration', preg_replace('/\\.[^.\\s]{3,4}$/', '', $file))->delete();
    }