@@ -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; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | { |
34 | 34 | $this->publishes( |
35 | 35 | [ |
36 | - realpath(__DIR__.'/../').'/config/db-exporter.php' => config_path('db-exporter.php'), |
|
36 | + realpath(__DIR__ . '/../') . '/config/db-exporter.php' => config_path('db-exporter.php'), |
|
37 | 37 | ], |
38 | 38 | 'config' |
39 | 39 | ); |
40 | 40 | |
41 | 41 | $this->mergeConfigFrom( |
42 | - realpath(__DIR__.'/../').'/config/db-exporter.php', |
|
42 | + realpath(__DIR__ . '/../') . '/config/db-exporter.php', |
|
43 | 43 | 'db-exporter' |
44 | 44 | ); |
45 | 45 | // Instatiate a new DbMigrations class to send to the handler |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $this->app->singleton( |
100 | 100 | 'db-exporter.migrations', |
101 | - function ($app) { |
|
101 | + function($app) { |
|
102 | 102 | return new Commands\MigrationsGeneratorCommand($app[DbExportHandler::class]); |
103 | 103 | } |
104 | 104 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $this->app->singleton( |
115 | 115 | 'db-exporter.seeds', |
116 | - function ($app) { |
|
116 | + function($app) { |
|
117 | 117 | return new Commands\SeedGeneratorCommand($app[DbExportHandler::class]); |
118 | 118 | } |
119 | 119 | ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $this->app->singleton( |
127 | 127 | 'db-exporter.backup', |
128 | - function () { |
|
128 | + function() { |
|
129 | 129 | return new Commands\CopyToRemoteCommand(new Server()); |
130 | 130 | } |
131 | 131 | ); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $this->app->bind( |
142 | 142 | DbExportHandler::class, |
143 | - function ($app) { |
|
143 | + function($app) { |
|
144 | 144 | // Instatiate a new DbSeeding class to send to the handler |
145 | 145 | $seeder = new DbSeeding($app[DbMigrations::class]->database); |
146 | 146 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $this->app->bind( |
153 | 153 | 'DbExporter', |
154 | - function ($app) { |
|
154 | + function($app) { |
|
155 | 155 | return $app[DbExportHandler::class]; |
156 | 156 | } |
157 | 157 | ); |
@@ -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); |