| @@ -36,7 +36,7 @@ discard block | ||
| 36 | 36 |              $this->line("\n"); | 
| 37 | 37 | $this->info(ucfirst($type)); | 
| 38 | 38 |              foreach ($files as $file) { | 
| 39 | - $this->sectionMessage($type, $file.' uploaded.'); | |
| 39 | + $this->sectionMessage($type, $file . ' uploaded.'); | |
| 40 | 40 | } | 
| 41 | 41 | } | 
| 42 | 42 | |
| @@ -80,19 +80,18 @@ discard block | ||
| 80 | 80 | |
| 81 | 81 | protected function upload($what) | 
| 82 | 82 |      { | 
| 83 | -        $localPath = Config::get('db-exporter.export_path.'.$what); | |
| 83 | +        $localPath = Config::get('db-exporter.export_path.' . $what); | |
| 84 | 84 | $dir = scandir($localPath); | 
| 85 | -        $remotePath = Config::get('db-exporter.remote.'.$what); | |
| 85 | +        $remotePath = Config::get('db-exporter.remote.' . $what); | |
| 86 | 86 |          $this->line("\n"); | 
| 87 | 87 | $this->info(ucfirst($what)); | 
| 88 | 88 | // Reset file coounter | 
| 89 | 89 | static::$filesCount = 0; | 
| 90 | 90 | // Prepare the progress bar | 
| 91 | -        array_walk($dir, function ($file) { | |
| 91 | +        array_walk($dir, function($file) { | |
| 92 | 92 |              if ($this->ignoredFile($file)) { | 
| 93 | 93 | return; | 
| 94 | - } | |
| 95 | - ++static::$filesCount; | |
| 94 | + }++static::$filesCount; | |
| 96 | 95 | }); | 
| 97 | 96 | $progress = $this->output->createProgressBar(static::$filesCount); | 
| 98 | 97 |          foreach ($dir as $file) { | 
| @@ -102,12 +101,12 @@ discard block | ||
| 102 | 101 | } | 
| 103 | 102 | |
| 104 | 103 | // Capture the uploaded files for displaying later | 
| 105 | - $this->uploadedFiles[$what][] = $remotePath.$file; | |
| 104 | + $this->uploadedFiles[$what][] = $remotePath . $file; | |
| 106 | 105 | |
| 107 | 106 | // Copy the files | 
| 108 | 107 | Storage::disk($this->getDiskName())->put( | 
| 109 | - $remotePath.$file, | |
| 110 | - $localPath.'/'.$file | |
| 108 | + $remotePath . $file, | |
| 109 | + $localPath . '/' . $file | |
| 111 | 110 | ); | 
| 112 | 111 | $progress->advance(); | 
| 113 | 112 | } | 
| @@ -32,6 +32,9 @@ discard block | ||
| 32 | 32 | |
| 33 | 33 | //end getDatabaseName() | 
| 34 | 34 | |
| 35 | + /** | |
| 36 | + * @param string $title | |
| 37 | + */ | |
| 35 | 38 | protected function blockMessage($title, $message, $style = 'info') | 
| 36 | 39 |      { | 
| 37 | 40 | // Symfony style block messages | 
| @@ -46,6 +49,9 @@ discard block | ||
| 46 | 49 | |
| 47 | 50 | //end blockMessage() | 
| 48 | 51 | |
| 52 | + /** | |
| 53 | + * @param string $message | |
| 54 | + */ | |
| 49 | 55 | protected function sectionMessage($title, $message) | 
| 50 | 56 |      { | 
| 51 | 57 |          $formatter = $this->getHelperSet()->get('formatter'); | 
| @@ -86,6 +92,9 @@ discard block | ||
| 86 | 92 | |
| 87 | 93 | //end getOptions() | 
| 88 | 94 | |
| 95 | + /** | |
| 96 | + * @param string $action | |
| 97 | + */ | |
| 89 | 98 | protected function fireAction($action, $database) | 
| 90 | 99 |      { | 
| 91 | 100 | // Grab the options | 
| @@ -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() | 
| @@ -53,9 +53,9 @@ | ||
| 53 | 53 | |
| 54 | 54 | private function getFilename() | 
| 55 | 55 |      { | 
| 56 | - $filename = ucfirst(Str::camel($this->database)).'DatabaseSeeder'; | |
| 56 | + $filename = ucfirst(Str::camel($this->database)) . 'DatabaseSeeder'; | |
| 57 | 57 | |
| 58 | -        return Config::get('db-exporter.export_path.seeds')."/{$filename}.php"; | |
| 58 | +        return Config::get('db-exporter.export_path.seeds') . "/{$filename}.php"; | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | //end getFilename() | 
| @@ -27,17 +27,17 @@ | ||
| 27 | 27 | * @var array | 
| 28 | 28 | **/ | 
| 29 | 29 | protected $selects = [ | 
| 30 | - 'column_name as Field', | |
| 31 | - 'column_type as Type', | |
| 32 | - 'is_nullable as Nullable', | |
| 33 | - 'column_key as Key', | |
| 34 | - 'column_default as Default', | |
| 35 | - 'extra as Extra', | |
| 36 | - 'data_type as Data_Type', | |
| 37 | - 'CHARACTER_MAXIMUM_LENGTH as Length', | |
| 38 | - 'NUMERIC_PRECISION as Precision', | |
| 39 | - 'NUMERIC_SCALE as Scale', | |
| 40 | - ]; | |
| 30 | + 'column_name as Field', | |
| 31 | + 'column_type as Type', | |
| 32 | + 'is_nullable as Nullable', | |
| 33 | + 'column_key as Key', | |
| 34 | + 'column_default as Default', | |
| 35 | + 'extra as Extra', | |
| 36 | + 'data_type as Data_Type', | |
| 37 | + 'CHARACTER_MAXIMUM_LENGTH as Length', | |
| 38 | + 'NUMERIC_PRECISION as Precision', | |
| 39 | + 'NUMERIC_SCALE as Scale', | |
| 40 | + ]; | |
| 41 | 41 | /** | 
| 42 | 42 | * Select fields from constraints. | 
| 43 | 43 | * | 
| @@ -56,14 +56,14 @@ discard block | ||
| 56 | 56 |      { | 
| 57 | 57 | $pdo = DB::connection()->getPdo(); | 
| 58 | 58 | |
| 59 | -        return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="'.$this->database.'"'); | |
| 59 | +        return $pdo->query('SELECT table_name FROM information_schema.tables WHERE table_schema="' . $this->database . '"'); | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | public function getTableIndexes($table) | 
| 63 | 63 |      { | 
| 64 | 64 | $pdo = DB::connection()->getPdo(); | 
| 65 | 65 | |
| 66 | -        return $pdo->query('SHOW INDEX FROM '.$this->database.'.'.$table.' WHERE Key_name != "PRIMARY"'); | |
| 66 | +        return $pdo->query('SHOW INDEX FROM ' . $this->database . '.' . $table . ' WHERE Key_name != "PRIMARY"'); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | 69 | /** | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | */ | 
| 108 | 108 | protected function getTableData($table) | 
| 109 | 109 |      { | 
| 110 | - return DB::table($this->database.'.'.$table)->get(); | |
| 110 | + return DB::table($this->database . '.' . $table)->get(); | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | 
| @@ -122,7 +122,7 @@ discard block | ||
| 122 | 122 | $directories = explode($del, $path); | 
| 123 | 123 |          foreach ($directories as $directory) { | 
| 124 | 124 |              if (!empty($directory)) { | 
| 125 | - $dir .= $del.$directory; | |
| 125 | + $dir .= $del . $directory; | |
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | 128 |              if (!is_dir($dir)) { | 
| @@ -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': |