@@ -145,7 +145,7 @@ |
||
145 | 145 | /** |
146 | 146 | * undocumented function |
147 | 147 | * |
148 | - * @return void |
|
148 | + * @return string |
|
149 | 149 | * @author |
150 | 150 | **/ |
151 | 151 | protected function columnType($type) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $schema = $this->compile(); |
46 | 46 | $filename = date('Y_m_d_His') . "_create_" . $this->database . "_database.php"; |
47 | - static::$filePath = Config::get('db-exporter.export_path.migrations')."{$filename}"; |
|
47 | + static::$filePath = Config::get('db-exporter.export_path.migrations') . "{$filename}"; |
|
48 | 48 | |
49 | 49 | file_put_contents(static::$filePath, $schema); |
50 | 50 | |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $numbers = ""; |
87 | 87 | $nullable = $values->Null == "NO" ? "" : "->nullable()"; |
88 | 88 | $default = empty($values->Default) ? "" : "->default(\"{$values->Default}\")"; |
89 | - $unsigned = strpos($values->Type, "unsigned") === false ? '': '->unsigned()'; |
|
89 | + $unsigned = strpos($values->Type, "unsigned") === false ? '' : '->unsigned()'; |
|
90 | 90 | |
91 | 91 | if (in_array($type, ['var', 'varchar', 'enum', 'decimal', 'float'])) { |
92 | 92 | $para = strpos($values->Type, '('); |
93 | 93 | $numbers = ", " . substr($values->Type, $para + 1, -1); |
94 | - if($type==='enum'){ |
|
94 | + if ($type === 'enum') { |
|
95 | 95 | $numbers = ', array(' . $numbers . ')'; |
96 | 96 | } |
97 | 97 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $tableIndexes = $this->getTableIndexes($value['table_name']); |
108 | - if (!is_null($tableIndexes) && count($tableIndexes)){ |
|
108 | + if (!is_null($tableIndexes) && count($tableIndexes)) { |
|
109 | 109 | foreach ($tableIndexes as $index) { |
110 | - if(Str::endsWith($index['Key_name'], '_index')) |
|
110 | + if (Str::endsWith($index['Key_name'], '_index')) |
|
111 | 111 | $up .= ' $' . "table->index('" . $index['Key_name'] . "');\n"; |
112 | 112 | } |
113 | 113 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * @var array $tableConstraints |
119 | 119 | */ |
120 | 120 | $tableConstraints = $this->getTableConstraints($value['table_name']); |
121 | - if (!is_null($tableConstraints) && count($tableConstraints)){ |
|
121 | + if (!is_null($tableConstraints) && count($tableConstraints)) { |
|
122 | 122 | $Constraint = $ConstraintDown = " |
123 | 123 | Schema::table('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
124 | 124 | $tables = []; |
125 | 125 | foreach ($tableConstraints as $foreign) { |
126 | - if(!in_array($foreign->Field, $tables)){ |
|
127 | - $ConstraintDown .= ' $' . "table->dropForeign('" . $foreign->Field. "');\n"; |
|
128 | - $Constraint .= ' $' . "table->foreign('" . $foreign->Field. "')->references('" . $foreign->References . "')->on('" . $foreign->ON. "')->onDelete('" . $foreign->onDelete. "');\n"; |
|
126 | + if (!in_array($foreign->Field, $tables)) { |
|
127 | + $ConstraintDown .= ' $' . "table->dropForeign('" . $foreign->Field . "');\n"; |
|
128 | + $Constraint .= ' $' . "table->foreign('" . $foreign->Field . "')->references('" . $foreign->References . "')->on('" . $foreign->ON . "')->onDelete('" . $foreign->onDelete . "');\n"; |
|
129 | 129 | $tables[$foreign->Field] = $foreign->Field; |
130 | 130 | } |
131 | 131 | } |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * Table: {$name} |
230 | 230 | */ |
231 | 231 | {$values['up']}"; |
232 | - $upConstraint.=" |
|
232 | + $upConstraint .= " |
|
233 | 233 | {$values['constraint']}"; |
234 | - $downConstraint.=" |
|
234 | + $downConstraint .= " |
|
235 | 235 | {$values['constraint_down']}"; |
236 | 236 | |
237 | 237 | $downSchema .= " |