@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $schema = $this->compile(); |
109 | 109 | $absolutePath = Config::get('db-exporter.export_path.migrations'); |
110 | 110 | $this->makePath($absolutePath); |
111 | - $this->filename = date('Y_m_d_His').'_create_'.$this->database.'_database.php'; |
|
112 | - static::$filePath = $absolutePath."/{$this->filename}"; |
|
111 | + $this->filename = date('Y_m_d_His') . '_create_' . $this->database . '_database.php'; |
|
112 | + static::$filePath = $absolutePath . "/{$this->filename}"; |
|
113 | 113 | file_put_contents(static::$filePath, $schema); |
114 | 114 | |
115 | 115 | return static::$filePath; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | $down = "Schema::dropIfExists('{$value['table_name']}');"; |
145 | - $up = "Schema::create('{$value['table_name']}', function(Blueprint $"."table) {\n"; |
|
145 | + $up = "Schema::create('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
|
146 | 146 | |
147 | 147 | $tableDescribes = $this->getTableDescribes($value['table_name']); |
148 | 148 | // Loop over the tables fields |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - $up .= ' $'."table->{$this->methodName}('{$values->Field}'{$this->defaultLength}){$this->primaryKey}{$nullable}{$default}{$unsigned};\n"; |
|
165 | + $up .= ' $' . "table->{$this->methodName}('{$values->Field}'{$this->defaultLength}){$this->primaryKey}{$nullable}{$default}{$unsigned};\n"; |
|
166 | 166 | $this->unsetData(); |
167 | 167 | }//end foreach |
168 | 168 | |
169 | - $tableIndexes = (array) $this->getTableIndexes($value['table_name']); |
|
169 | + $tableIndexes = (array)$this->getTableIndexes($value['table_name']); |
|
170 | 170 | if (!is_null($tableIndexes) && count($tableIndexes)) { |
171 | 171 | foreach ($tableIndexes as $index) { |
172 | 172 | if (Str::endsWith(@$index['Key_name'], '_index')) { |
173 | - $up .= ' $'."table->index('".$index['Column_name']."');\n"; |
|
173 | + $up .= ' $' . "table->index('" . $index['Column_name'] . "');\n"; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | $tableConstraints = $this->getTableConstraints($value['table_name']); |
184 | 184 | if (!is_null($tableConstraints) && $tableConstraints->count()) { |
185 | 185 | $Constraint = $ConstraintDown = " |
186 | - Schema::table('{$value['table_name']}', function(Blueprint $"."table) {\n"; |
|
186 | + Schema::table('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
|
187 | 187 | $tables = []; |
188 | 188 | foreach ($tableConstraints as $foreign) { |
189 | 189 | if (!in_array($foreign->Field, $tables)) { |
190 | 190 | $field = "{$foreign->Table}_{$foreign->Field}_foreign"; |
191 | - $ConstraintDown .= ' $'."table->dropForeign('".$field."');\n"; |
|
192 | - $Constraint .= ' $'."table->foreign('".$foreign->Field."')->references('".$foreign->References."')->on('".$foreign->ON."')->onDelete('".$foreign->onDelete."');\n"; |
|
191 | + $ConstraintDown .= ' $' . "table->dropForeign('" . $field . "');\n"; |
|
192 | + $Constraint .= ' $' . "table->foreign('" . $foreign->Field . "')->references('" . $foreign->References . "')->on('" . $foreign->ON . "')->onDelete('" . $foreign->onDelete . "');\n"; |
|
193 | 193 | $tables[$foreign->Field] = $foreign->Field; |
194 | 194 | } |
195 | 195 | } |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | }//end if |
257 | 257 | |
258 | 258 | // Grab the template |
259 | - $template = File::get(__DIR__.'/stubs/migration.stub'); |
|
259 | + $template = File::get(__DIR__ . '/stubs/migration.stub'); |
|
260 | 260 | |
261 | 261 | // Replace the classname |
262 | - $template = str_replace('{{name}}', 'Create'.ucfirst(Str::camel($this->database)).'Database', $template); |
|
262 | + $template = str_replace('{{name}}', 'Create' . ucfirst(Str::camel($this->database)) . 'Database', $template); |
|
263 | 263 | |
264 | 264 | // Replace the up and down values |
265 | 265 | $template = str_replace('{{up}}', $upSchema, $template); |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | $values = substr($column->Type, ($hasSize + 1), -1); |
282 | 282 | switch ($type) { |
283 | 283 | case 'enum': |
284 | - $this->defaultLength = ', array('.$values.')'; |
|
284 | + $this->defaultLength = ', array(' . $values . ')'; |
|
285 | 285 | break; |
286 | 286 | case 'char': |
287 | 287 | case 'varchar': |
288 | 288 | case 'text': |
289 | 289 | case 'mediumtext': |
290 | 290 | case 'longtext': |
291 | - $this->defaultLength = ', '.$column->Length; |
|
291 | + $this->defaultLength = ', ' . $column->Length; |
|
292 | 292 | break; |
293 | 293 | case 'double': |
294 | 294 | case 'float': |