@@ -33,9 +33,9 @@ |
||
33 | 33 | { |
34 | 34 | $this->app->singleton( |
35 | 35 | DbMigrations::class, |
36 | - function () { |
|
36 | + function() { |
|
37 | 37 | $connType = Config::get('database.default'); |
38 | - $database = Config::get('database.connections.'.$connType); |
|
38 | + $database = Config::get('database.connections.' . $connType); |
|
39 | 39 | |
40 | 40 | return new DbMigrations($database['database']); |
41 | 41 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $seed = $this->compile(); |
56 | 56 | $absolutePath = Config::get('db-exporter.export_path.seeds'); |
57 | - $this->filename = ucfirst(Str::camel($this->database)).'DatabaseSeeder'; |
|
57 | + $this->filename = ucfirst(Str::camel($this->database)) . 'DatabaseSeeder'; |
|
58 | 58 | $this->makePath($absolutePath); |
59 | - file_put_contents($absolutePath."/{$this->filename}.php", $seed); |
|
59 | + file_put_contents($absolutePath . "/{$this->filename}.php", $seed); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | //end write() |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if ($this->hasTableData($tableData)) { |
108 | 108 | $stub .= " |
109 | - DB::table('".$tableName."')->insert([ |
|
109 | + DB::table('".$tableName . "')->insert([ |
|
110 | 110 | {$insertStub} |
111 | 111 | ]);"; |
112 | 112 | } |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | protected function compile() |
128 | 128 | { |
129 | 129 | // Grab the template |
130 | - $template = File::get(__DIR__.'/stubs/seed.stub'); |
|
130 | + $template = File::get(__DIR__ . '/stubs/seed.stub'); |
|
131 | 131 | |
132 | 132 | // Replace the classname |
133 | - $template = str_replace('{{className}}', ucfirst(Str::camel($this->database)).'DatabaseSeeder', $template); |
|
133 | + $template = str_replace('{{className}}', ucfirst(Str::camel($this->database)) . 'DatabaseSeeder', $template); |
|
134 | 134 | $template = str_replace('{{run}}', $this->seedingStub, $template); |
135 | 135 | |
136 | 136 | return $template; |
@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public function ignore(...$tables) |
89 | 89 | { |
90 | - DbExporter::$ignore = array_merge(DbExporter::$ignore, (array) $tables); |
|
90 | + DbExporter::$ignore = array_merge(DbExporter::$ignore, (array)$tables); |
|
91 | 91 | |
92 | 92 | return $this; |
93 | 93 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | protected function getDatabaseName() |
26 | 26 | { |
27 | 27 | $connType = Config::get('database.default'); |
28 | - $database = Config::get('database.connections.'.$connType); |
|
28 | + $database = Config::get('database.connections.' . $connType); |
|
29 | 29 | |
30 | 30 | return $database['database']; |
31 | 31 | } |
@@ -57,9 +57,9 @@ |
||
57 | 57 | |
58 | 58 | private function getFilename() |
59 | 59 | { |
60 | - $filename = ucfirst(Str::camel($this->database)).'DatabaseSeeder'; |
|
60 | + $filename = ucfirst(Str::camel($this->database)) . 'DatabaseSeeder'; |
|
61 | 61 | |
62 | - return Config::get('db-exporter.export_path.seeds')."/{$filename}.php"; |
|
62 | + return Config::get('db-exporter.export_path.seeds') . "/{$filename}.php"; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //end getFilename() |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->line("\n"); |
39 | 39 | $this->info(ucfirst($type)); |
40 | 40 | foreach ($files as $file) { |
41 | - $this->sectionMessage($type, $file.' uploaded.'); |
|
41 | + $this->sectionMessage($type, $file . ' uploaded.'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | private function upload($what) |
111 | 111 | { |
112 | - $localPath = Config::get('db-exporter.export_path.'.$what); |
|
112 | + $localPath = Config::get('db-exporter.export_path.' . $what); |
|
113 | 113 | $dir = scandir($localPath); |
114 | - $remotePath = Config::get('db-exporter.remote.'.$what); |
|
114 | + $remotePath = Config::get('db-exporter.remote.' . $what); |
|
115 | 115 | $this->line("\n"); |
116 | 116 | $this->info(ucfirst($what)); |
117 | 117 | // Prepare the progress bar |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | // Capture the uploaded files for displaying later |
126 | - $this->uploadedFiles[$what][] = $remotePath.$file; |
|
126 | + $this->uploadedFiles[$what][] = $remotePath . $file; |
|
127 | 127 | |
128 | 128 | // Copy the files |
129 | 129 | Storage::disk($this->getDiskName())->put( |
130 | - $remotePath.$file, |
|
131 | - $localPath.'/'.$file |
|
130 | + $remotePath . $file, |
|
131 | + $localPath . '/' . $file |
|
132 | 132 | ); |
133 | 133 | $progress->advance(); |
134 | 134 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->fireAction('migrate', $database); |
39 | 39 | |
40 | 40 | // Symfony style block messages |
41 | - $this->blockMessage('Success!', 'Database migrations generated in: '.$this->handler->getMigrationsFilePath()); |
|
41 | + $this->blockMessage('Success!', 'Database migrations generated in: ' . $this->handler->getMigrationsFilePath()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | //end fire() |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $schema = $this->compile(); |
79 | 79 | $absolutePath = Config::get('db-exporter.export_path.migrations'); |
80 | 80 | $this->makePath($absolutePath); |
81 | - $this->filename = date('Y_m_d_His').'_create_'.$this->database.'_database.php'; |
|
82 | - static::$filePath = $absolutePath."/{$this->filename}"; |
|
81 | + $this->filename = date('Y_m_d_His') . '_create_' . $this->database . '_database.php'; |
|
82 | + static::$filePath = $absolutePath . "/{$this->filename}"; |
|
83 | 83 | file_put_contents(static::$filePath, $schema); |
84 | 84 | |
85 | 85 | return static::$filePath; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $down = "Schema::drop('{$value['table_name']}');"; |
115 | - $up = "Schema::create('{$value['table_name']}', function(Blueprint $"."table) {\n"; |
|
115 | + $up = "Schema::create('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
|
116 | 116 | |
117 | 117 | $tableDescribes = $this->getTableDescribes($value['table_name']); |
118 | 118 | // Loop over the tables fields |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if (in_array($type, ['var', 'varchar', 'enum', 'decimal', 'float'])) { |
129 | 129 | $para = strpos($values->Type, '('); |
130 | 130 | $opt = substr($values->Type, ($para + 1), -1); |
131 | - $numbers = $type == 'enum' ? ', array('.$opt.')' : ', '.$opt; |
|
131 | + $numbers = $type == 'enum' ? ', array(' . $opt . ')' : ', ' . $opt; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $method = $this->columnType($type); |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | $method = 'increments'; |
137 | 137 | } |
138 | 138 | |
139 | - $up .= ' $'."table->{$method}('{$values->Field}'{$numbers}){$nullable}{$default}{$unsigned};\n"; |
|
139 | + $up .= ' $' . "table->{$method}('{$values->Field}'{$numbers}){$nullable}{$default}{$unsigned};\n"; |
|
140 | 140 | }//end foreach |
141 | 141 | |
142 | 142 | $tableIndexes = $this->getTableIndexes($value['table_name']); |
143 | 143 | if (!is_null($tableIndexes) && count($tableIndexes)) { |
144 | 144 | foreach ($tableIndexes as $index) { |
145 | 145 | if (Str::endsWith($index['Key_name'], '_index')) { |
146 | - $up .= ' $'."table->index('".$index['Column_name']."');\n"; |
|
146 | + $up .= ' $' . "table->index('" . $index['Column_name'] . "');\n"; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | } |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | $tableConstraints = $this->getTableConstraints($value['table_name']); |
157 | 157 | if (!is_null($tableConstraints) && count($tableConstraints)) { |
158 | 158 | $Constraint = $ConstraintDown = " |
159 | - Schema::table('{$value['table_name']}', function(Blueprint $"."table) {\n"; |
|
159 | + Schema::table('{$value['table_name']}', function(Blueprint $" . "table) {\n"; |
|
160 | 160 | $tables = []; |
161 | 161 | foreach ($tableConstraints as $foreign) { |
162 | 162 | if (!in_array($foreign->Field, $tables)) { |
163 | - $ConstraintDown .= ' $'."table->dropForeign('".$foreign->Field."');\n"; |
|
164 | - $Constraint .= ' $'."table->foreign('".$foreign->Field."')->references('".$foreign->References."')->on('".$foreign->ON."')->onDelete('".$foreign->onDelete."');\n"; |
|
163 | + $ConstraintDown .= ' $' . "table->dropForeign('" . $foreign->Field . "');\n"; |
|
164 | + $Constraint .= ' $' . "table->foreign('" . $foreign->Field . "')->references('" . $foreign->References . "')->on('" . $foreign->ON . "')->onDelete('" . $foreign->onDelete . "');\n"; |
|
165 | 165 | $tables[$foreign->Field] = $foreign->Field; |
166 | 166 | } |
167 | 167 | } |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | }//end if |
229 | 229 | |
230 | 230 | // Grab the template |
231 | - $template = File::get(__DIR__.'/stubs/migration.stub'); |
|
231 | + $template = File::get(__DIR__ . '/stubs/migration.stub'); |
|
232 | 232 | |
233 | 233 | // Replace the classname |
234 | - $template = str_replace('{{name}}', 'Create'.ucfirst(Str::camel($this->database)).'Database', $template); |
|
234 | + $template = str_replace('{{name}}', 'Create' . ucfirst(Str::camel($this->database)) . 'Database', $template); |
|
235 | 235 | |
236 | 236 | // Replace the up and down values |
237 | 237 | $template = str_replace('{{up}}', $upSchema, $template); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $pdo = DB::connection()->getPdo(); |
55 | 55 | |
56 | - return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="'.$this->database.'"'); |
|
56 | + return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="' . $this->database . '"'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | //end getTables() |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $pdo = DB::connection()->getPdo(); |
64 | 64 | |
65 | - return $pdo->query('SHOW INDEX FROM '.$this->database.'.'.$table.' WHERE Key_name != "PRIMARY"'); |
|
65 | + return $pdo->query('SHOW INDEX FROM ' . $this->database . '.' . $table . ' WHERE Key_name != "PRIMARY"'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | //end getTableIndexes() |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | protected function getTableData($table) |
114 | 114 | { |
115 | - return DB::table($this->database.'.'.$table)->get(); |
|
115 | + return DB::table($this->database . '.' . $table)->get(); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | //end getTableData() |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $directories = explode($del, $path); |
130 | 130 | foreach ($directories as $directory) { |
131 | 131 | if (!empty($directory)) { |
132 | - $dir .= $del.$directory; |
|
132 | + $dir .= $del . $directory; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (!is_dir($dir)) { |