private function createMigrationFile($connection, $class)
    {
        // Interate the database file.
        $next_interation = $this->getNextInteration();

        // Create an extension of this migration script in the database/migrations folder.
        $alias_file_name = sprintf('%s_%s_create_%s_table', date('Y_m_d'), str_pad($next_interation, 3, '0', STR_PAD_LEFT), $this->argument('dataset'));
        $alias_file = sprintf('%s/%s.php', base_path('database/migrations'), $alias_file_name);
        $alias_class = sprintf('Create%sTable', studly_case($this->argument('dataset')));

        $class_name = preg_replace('/.*\\\\/', '', $class);

        // Generate contents for database file.
        $contents = sprintf("<?php\n\nuse %s as SourceTable;\n\nclass %s extends SourceTable\n{\n\tprotected $connection = '%s';\n\n}\n", $class, $class_name, $connection);

        // Add the migration to the tracking table.
        file_put_contents($alias_file, $contents);

        // Update the migrations table.
        DB::connection(config('database.default'))->unprepared(sprintf("INSERT INTO migrations SET migration='%s',batch=(SELECT max(batch)+1 FROM (SELECT batch FROM migrations) AS source_batch)", $alias_file_name));
    }
private function createMigrationFile($connection, $class)
    {
        // Interate the database file.
        $next_interation = $this->getNextInteration();

        // Create an extension of this migration script in the database/migrations folder.
        $alias_file_name = sprintf('%s_%s_create_%s_table', date('Y_m_d'), str_pad($next_interation, 3, '0', STR_PAD_LEFT), $this->argument('dataset'));
        $alias_file = sprintf('%s/%s.php', base_path('database/migrations'), $alias_file_name);
        $alias_class = sprintf('Create%sTable', studly_case($this->argument('dataset')));

        $class_name = preg_replace('/.*\\\\/', '', $class);

        // Generate contents for database file.
        $contents = sprintf("<?php\n\nuse %s as SourceTable;\n\nclass %s extends SourceTable\n{\n\tprotected $connection = '%s';\n\n}\n", $class, $class_name, $connection);

        // Add the migration to the tracking table.
        file_put_contents($alias_file, $contents);

        // Update the migrations table.
        DB::connection(config('database.default'))->unprepared(sprintf("INSERT INTO migrations SET migration='%s',batch=(SELECT max(batch)+1 FROM (SELECT batch FROM migrations) AS source_batch)", $alias_file_name));
    }
private function createMigrationFile ( $ connection , $ class ) { // Interate the database file. $ next_interation = $ this -> getNextInteration ( ) ; // Create an extension of this migration script in the database/migrations folder. $ alias_file_name = sprintf ( '%s_%s_create_%s_table' , date ( 'Y_m_d' ) , str_pad ( $ next_interation , 3 , '0' , STR_PAD_LEFT ) , $ this -> argument ( 'dataset' ) ) ; $ alias_file = sprintf ( '%s/%s.php' , base_path ( 'database/migrations' ) , $ alias_file_name ) ; $ alias_class = sprintf ( 'Create%sTable' , studly_case ( $ this -> argument ( 'dataset' ) ) ) ; $ class_name = preg_replace ( '/.*\\\\/' , '' , $ class ) ; // Generate contents for database file. $ contents = sprintf ( "<?php\n\nuse %s as SourceTable;\n\nclass %s extends SourceTable\n{\n\tprotected $connection = '%s';\n\n}\n" , $ class , $ class_name , $ connection ) ; // Add the migration to the tracking table. file_put_contents ( $ alias_file , $ contents ) ; // Update the migrations table. DB :: connection ( config ( 'database.default' ) ) -> unprepared ( sprintf ( "INSERT INTO migrations SET migration='%s',batch=(SELECT max(batch)+1 FROM (SELECT batch FROM migrations) AS source_batch)" , $ alias_file_name ) ) ; }
Create the migration file.

@param string $connection
@param string $class

@return void
Create the migration file .