@@ -15,7 +15,7 @@ |
||
15 | 15 | protected function getDatabaseName() |
16 | 16 | { |
17 | 17 | $connType = Config::get('database.default'); |
18 | - $database = Config::get('database.connections.' .$connType ); |
|
18 | + $database = Config::get('database.connections.' . $connType); |
|
19 | 19 | |
20 | 20 | return $database['database']; |
21 | 21 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | private function getFilename() |
64 | 64 | { |
65 | 65 | $filename = Str::camel($this->getDatabaseName()) . "TableSeeder"; |
66 | - return Config::get('db-exporter.export_path.seeds')."/{$filename}.php"; |
|
66 | + return Config::get('db-exporter.export_path.seeds') . "/{$filename}.php"; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | protected $name = 'db-exporter:remote'; |
14 | 14 | protected $description = 'Command to copy the migrations and/or the seeds to a remote host.'; |
15 | 15 | |
16 | - protected $ignoredFiles = array('..', '.', '.gitkeep'); |
|
16 | + protected $ignoredFiles = array('..', '.', '.gitkeep'); |
|
17 | 17 | |
18 | 18 | protected $migrationsPath; |
19 | 19 | protected $seedsPath; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | foreach ($this->uploadedFiles as $type => $files) { |
42 | 42 | $this->info(ucfirst($type)); |
43 | 43 | foreach ($files as $file) { |
44 | - $this->sectionMessage($type, $file .' uploaded.'); |
|
44 | + $this->sectionMessage($type, $file . ' uploaded.'); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | $localPath = "{$what}Path"; |
100 | 100 | |
101 | 101 | $dir = scandir($this->$localPath); |
102 | - $remotePath = Config::get('db-exporter.remote.'.$what); |
|
102 | + $remotePath = Config::get('db-exporter.remote.' . $what); |
|
103 | 103 | |
104 | 104 | // Prepare the progress bar |
105 | 105 | $progress = $this->getHelperSet()->get('progress'); |
106 | 106 | $filesCount = count($dir) - count($this->ignoredFiles); |
107 | 107 | $progress->start($this->output, $filesCount); |
108 | 108 | $this->info(ucfirst($what)); |
109 | - foreach($dir as $file) { |
|
109 | + foreach ($dir as $file) { |
|
110 | 110 | if (in_array($file, $this->ignoredFiles)) { |
111 | 111 | continue; |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // Copy the files |
118 | 118 | SSH::into($this->getRemoteName())->put( |
119 | - $this->$localPath .'/' . $file, |
|
119 | + $this->$localPath . '/' . $file, |
|
120 | 120 | $remotePath . $file |
121 | 121 | ); |
122 | 122 | $progress->advance(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $schema = $this->compile(); |
64 | 64 | $filename = date('Y_m_d_His') . "_create_" . $this->database . "_database.php"; |
65 | - static::$filePath = Config::get('db-exporter.export_path.migrations')."{$filename}"; |
|
65 | + static::$filePath = Config::get('db-exporter.export_path.migrations') . "{$filename}"; |
|
66 | 66 | |
67 | 67 | file_put_contents(static::$filePath, $schema); |
68 | 68 | |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | $tableIndexes = $this->getTableIndexes($value['table_name']); |
179 | - if (!is_null($tableIndexes) && count($tableIndexes)){ |
|
179 | + if (!is_null($tableIndexes) && count($tableIndexes)) { |
|
180 | 180 | foreach ($tableIndexes as $index) { |
181 | - if(Str::endsWith($index['Key_name'], '_index')) |
|
181 | + if (Str::endsWith($index['Key_name'], '_index')) |
|
182 | 182 | $up .= ' $' . "table->index('" . $index['Key_name'] . "');\n"; |
183 | 183 | } |
184 | 184 | } |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $up .= " });\n\n"; |
187 | 187 | $Constraint = $ConstraintDown = ""; |
188 | 188 | $tableConstraints = $this->getTableConstraints($value['table_name']); |
189 | - if (!is_null($tableConstraints) && count($tableConstraints)){ |
|
189 | + if (!is_null($tableConstraints) && count($tableConstraints)) { |
|
190 | 190 | $Constraint = $ConstraintDown = " |
191 | 191 | Schema::table('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
192 | 192 | $tables = []; |
193 | 193 | foreach ($tableConstraints as $foreign) { |
194 | - if(!in_array($foreign->Field, $tables)){ |
|
195 | - $ConstraintDown .= ' $' . "table->dropForeign('" . $foreign->Field. "');\n"; |
|
196 | - $Constraint .= ' $' . "table->foreign('" . $foreign->Field. "')->references('" . $foreign->References . "')->on('" . $foreign->ON. "')->onDelete('" . $foreign->onDelete. "');\n"; |
|
194 | + if (!in_array($foreign->Field, $tables)) { |
|
195 | + $ConstraintDown .= ' $' . "table->dropForeign('" . $foreign->Field . "');\n"; |
|
196 | + $Constraint .= ' $' . "table->foreign('" . $foreign->Field . "')->references('" . $foreign->References . "')->on('" . $foreign->ON . "')->onDelete('" . $foreign->onDelete . "');\n"; |
|
197 | 197 | $tables[$foreign->Field] = $foreign->Field; |
198 | 198 | } |
199 | 199 | } |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | * Table: {$name} |
236 | 236 | */ |
237 | 237 | {$values['up']}"; |
238 | - $upConstraint.=" |
|
238 | + $upConstraint .= " |
|
239 | 239 | {$values['constraint']}"; |
240 | - $downConstraint.=" |
|
240 | + $downConstraint .= " |
|
241 | 241 | {$values['constraint_down']}"; |
242 | 242 | |
243 | 243 | $downSchema .= " |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | public function register() |
31 | 31 | { |
32 | 32 | $this->publishes([ |
33 | - realpath(__DIR__ .'/../').'/config/db-exporter.php' => config_path('db-exporter.php'), |
|
33 | + realpath(__DIR__ . '/../') . '/config/db-exporter.php' => config_path('db-exporter.php'), |
|
34 | 34 | ]); |
35 | 35 | |
36 | 36 | $this->mergeConfigFrom( |
37 | - realpath(__DIR__ .'/../').'/config/db-exporter.php', 'db-exporter' |
|
37 | + realpath(__DIR__ . '/../') . '/config/db-exporter.php', 'db-exporter' |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | $this->app->register(DbMigrationsServiceProvider::class); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | private function getDatabaseName() |
75 | 75 | { |
76 | 76 | $connType = Config::get('database.default'); |
77 | - $database = Config::get('database.connections.' .$connType ); |
|
77 | + $database = Config::get('database.connections.' . $connType); |
|
78 | 78 | |
79 | 79 | return $database['database']; |
80 | 80 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $dir = scandir($localPath); |
23 | 23 | $remotePath = Config::get('db-exporter.remote.' . $what); |
24 | 24 | |
25 | - foreach($dir as $file) { |
|
25 | + foreach ($dir as $file) { |
|
26 | 26 | if (in_array($file, $this->ignoredFiles)) { |
27 | 27 | continue; |
28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Copy the files |
34 | 34 | SSH::into($this->getRemoteName())->put( |
35 | - $localPath .'/' . $file, |
|
35 | + $localPath . '/' . $file, |
|
36 | 36 | $remotePath . $file |
37 | 37 | ); |
38 | 38 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $filename = Str::camel($this->database) . "TableSeeder"; |
47 | 47 | |
48 | - file_put_contents(Config::get('db-exporter.export_path.seeds')."/{$filename}.php", $seed); |
|
48 | + file_put_contents(Config::get('db-exporter.export_path.seeds') . "/{$filename}.php", $seed); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $value = addslashes($value); |
124 | 124 | if (is_numeric($value)) { |
125 | 125 | return " '{$prop}' => {$value},\n"; |
126 | - } elseif($value == '') { |
|
126 | + } elseif ($value == '') { |
|
127 | 127 | return " '{$prop}' => NULL,\n"; |
128 | 128 | } else { |
129 | 129 | return " '{$prop}' => '{$value}',\n"; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $this->app->singleton('DbMigrations', function() |
35 | 35 | { |
36 | 36 | $connType = Config::get('database.default'); |
37 | - $database = Config::get('database.connections.' .$connType ); |
|
37 | + $database = Config::get('database.connections.' . $connType); |
|
38 | 38 | return new DbMigrations($database); |
39 | 39 | }); |
40 | 40 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | return DB::table('information_schema.key_column_usage') |
52 | 52 | ->distinct() |
53 | - ->join('information_schema.REFERENTIAL_CONSTRAINTS', 'REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME','=','key_column_usage.CONSTRAINT_NAME') |
|
53 | + ->join('information_schema.REFERENTIAL_CONSTRAINTS', 'REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME', '=', 'key_column_usage.CONSTRAINT_NAME') |
|
54 | 54 | ->where('key_column_usage.table_schema', '=', $this->database) |
55 | 55 | ->where('key_column_usage.table_name', '=', $table) |
56 | 56 | ->get($this->constraints); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function getTableData($table) |
65 | 65 | { |
66 | - return DB::table($this->database.'.'.$table)->get(); |
|
66 | + return DB::table($this->database . '.' . $table)->get(); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |