public function createSchema($config, $section, $table, $splitTable, $schema)
    {
        $migrationFiles = $this->filesystem->allFiles($this->getMigrationsPath($config));

        if (!empty($section)) {
            $migrationName = 'create_'.str_plural(strtolower(implode('_', $splitTable))).'_table';
        } else {
            $migrationName = 'create_'.str_plural(strtolower(snake_case($table))).'_table';
        }

        $parsedTable = '';

        $definitions = $this->calibrateDefinitions($schema);

        foreach ($definitions as $key => $column) {
            $columnDefinition = explode(':', $column);
            $columnDetails = explode('|', $columnDefinition[1]);
            $columnDetailString = $this->createColumnDetailString($columnDetails);

            if ($key === 0) {
                $parsedTable .= $this->getSchemaString($columnDetails, $columnDefinition, $columnDetailString);
            } else {
                $parsedTable .= "\t\t\t".$this->getSchemaString($columnDetails, $columnDefinition, $columnDetailString);
            }
        }

        if (isset($config['relationships']) && !is_null($config['relationships'])) {
            $relationships = explode(',', $config['relationships']);
            foreach ($relationships as $relationship) {
                $relation = explode('|', $relationship);

                if (isset($relation[2])) {
                    if (!stristr($parsedTable, "integer('$relation[2]')")) {
                        $parsedTable .= "\t\t\t\$table->integer('$relation[2]');\n";
                    }
                }
            }
        }

        foreach ($migrationFiles as $file) {
            if (stristr($file->getBasename(), $migrationName)) {
                $migrationData = $this->filesystem->get($file->getPathname());
                $migrationData = str_replace("\$table->increments('id');", $parsedTable, $migrationData);
                $this->filesystem->put($file->getPathname(), $migrationData);
            }
        }

        return $parsedTable;
    }
public function createSchema($config, $section, $table, $splitTable, $schema)
    {
        $migrationFiles = $this->filesystem->allFiles($this->getMigrationsPath($config));

        if (!empty($section)) {
            $migrationName = 'create_'.str_plural(strtolower(implode('_', $splitTable))).'_table';
        } else {
            $migrationName = 'create_'.str_plural(strtolower(snake_case($table))).'_table';
        }

        $parsedTable = '';

        $definitions = $this->calibrateDefinitions($schema);

        foreach ($definitions as $key => $column) {
            $columnDefinition = explode(':', $column);
            $columnDetails = explode('|', $columnDefinition[1]);
            $columnDetailString = $this->createColumnDetailString($columnDetails);

            if ($key === 0) {
                $parsedTable .= $this->getSchemaString($columnDetails, $columnDefinition, $columnDetailString);
            } else {
                $parsedTable .= "\t\t\t".$this->getSchemaString($columnDetails, $columnDefinition, $columnDetailString);
            }
        }

        if (isset($config['relationships']) && !is_null($config['relationships'])) {
            $relationships = explode(',', $config['relationships']);
            foreach ($relationships as $relationship) {
                $relation = explode('|', $relationship);

                if (isset($relation[2])) {
                    if (!stristr($parsedTable, "integer('$relation[2]')")) {
                        $parsedTable .= "\t\t\t\$table->integer('$relation[2]');\n";
                    }
                }
            }
        }

        foreach ($migrationFiles as $file) {
            if (stristr($file->getBasename(), $migrationName)) {
                $migrationData = $this->filesystem->get($file->getPathname());
                $migrationData = str_replace("\$table->increments('id');", $parsedTable, $migrationData);
                $this->filesystem->put($file->getPathname(), $migrationData);
            }
        }

        return $parsedTable;
    }
public function createSchema ( $ config , $ section , $ table , $ splitTable , $ schema ) { $ migrationFiles = $ this -> filesystem -> allFiles ( $ this -> getMigrationsPath ( $ config ) ) ; if ( ! empty ( $ section ) ) { $ migrationName = 'create_' . str_plural ( strtolower ( implode ( '_' , $ splitTable ) ) ) . '_table' ; } else { $ migrationName = 'create_' . str_plural ( strtolower ( snake_case ( $ table ) ) ) . '_table' ; } $ parsedTable = '' ; $ definitions = $ this -> calibrateDefinitions ( $ schema ) ; foreach ( $ definitions as $ key => $ column ) { $ columnDefinition = explode ( ':' , $ column ) ; $ columnDetails = explode ( '|' , $ columnDefinition [ 1 ] ) ; $ columnDetailString = $ this -> createColumnDetailString ( $ columnDetails ) ; if ( $ key === 0 ) { $ parsedTable .= $ this -> getSchemaString ( $ columnDetails , $ columnDefinition , $ columnDetailString ) ; } else { $ parsedTable .= "\t\t\t" . $ this -> getSchemaString ( $ columnDetails , $ columnDefinition , $ columnDetailString ) ; } } if ( isset ( $ config [ 'relationships' ] ) && ! is_null ( $ config [ 'relationships' ] ) ) { $ relationships = explode ( ',' , $ config [ 'relationships' ] ) ; foreach ( $ relationships as $ relationship ) { $ relation = explode ( '|' , $ relationship ) ; if ( isset ( $ relation [ 2 ] ) ) { if ( ! stristr ( $ parsedTable , "integer('$relation[2]')" ) ) { $ parsedTable .= "\t\t\t\$table->integer('$relation[2]');\n" ; } } } } foreach ( $ migrationFiles as $ file ) { if ( stristr ( $ file -> getBasename ( ) , $ migrationName ) ) { $ migrationData = $ this -> filesystem -> get ( $ file -> getPathname ( ) ) ; $ migrationData = str_replace ( "\$table->increments('id');" , $ parsedTable , $ migrationData ) ; $ this -> filesystem -> put ( $ file -> getPathname ( ) , $ migrationData ) ; } } return $ parsedTable ; }
Create the Schema.

@param array $config
@param string $section
@param string $table
@param array  $splitTable

@return string
Create the Schema .