@@ -103,7 +103,7 @@ |
||
| 103 | 103 | // Seeding Dummy Data |
| 104 | 104 | $class = 'DatabaseManagerSeeder'; |
| 105 | 105 | $file = $this->seedersPath.$class.'.php'; |
| 106 | - if (file_exists($file) && ! class_exists($class)) { |
|
| 106 | + if (file_exists($file) && !class_exists($class)) { |
|
| 107 | 107 | require_once $file; |
| 108 | 108 | } |
| 109 | 109 | with(new $class())->run(); |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | if (!function_exists('dbm_asset')) { |
| 4 | 4 | function dbm_asset($path, $secure = null) |
| 5 | 5 | { |
| 6 | - return route('dbm.asset') . '?path=' . urlencode($path); |
|
| 6 | + return route('dbm.asset').'?path='.urlencode($path); |
|
| 7 | 7 | } |
| 8 | 8 | } |
| 9 | 9 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $jsonArr = []; |
| 35 | 35 | $i = 1; |
| 36 | 36 | foreach ($arr as $key => $value) { |
| 37 | - $jsonArr['key_' . $i++] = $value; |
|
| 37 | + $jsonArr['key_'.$i++] = $value; |
|
| 38 | 38 | } |
| 39 | 39 | return json_encode($jsonArr); |
| 40 | 40 | } |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $files = $request->file($column); |
| 44 | 44 | $values = []; |
| 45 | 45 | foreach ($files as $file) { |
| 46 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
| 47 | - $path = trim(config('dbm.filesystem.dir'), '/') . DIRECTORY_SEPARATOR . $tableName; |
|
| 46 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
| 47 | + $path = trim(config('dbm.filesystem.dir'), '/').DIRECTORY_SEPARATOR.$tableName; |
|
| 48 | 48 | $file->storeAs($path, $fileName); |
| 49 | 49 | $values[] = $fileName; |
| 50 | 50 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $fieldType = $this->getFieldType($tableName, $column); |
| 79 | 79 | |
| 80 | 80 | if (!in_array($fieldType, Type::getTypes())) { |
| 81 | - $this->generateError([$fieldType . " type not supported."]); |
|
| 81 | + $this->generateError([$fieldType." type not supported."]); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($fieldType != 'timestamp') { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $rules = $updateSettings->rules; |
| 253 | 253 | if (isset($updateSettings->localKey)) { |
| 254 | 254 | $localKey = $updateSettings->localKey; |
| 255 | - $rules = $updateSettings->rules . ',' . $columns->{$localKey}; |
|
| 255 | + $rules = $updateSettings->rules.','.$columns->{$localKey}; |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $dsn = config('database.connections.mongodb.dsn'); |
| 28 | 28 | |
| 29 | 29 | if (!$dsn) { |
| 30 | - $dsn = 'mongodb://' . $host . ':' . $port . ($auth_db ? "/" . $auth_db : ''); |
|
| 30 | + $dsn = 'mongodb://'.$host.':'.$port.($auth_db ? "/".$auth_db : ''); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | self::$connection = new Client($dsn); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | 'prefix' => 'database', |
| 5 | 5 | 'middleware' => 'auth:api', |
| 6 | 6 | 'namespace' => config('dbm.controller_namespace'), |
| 7 | -], function () { |
|
| 7 | +], function() { |
|
| 8 | 8 | |
| 9 | 9 | // Helpers Route |
| 10 | 10 | Route::get('assets', 'ManagerController@assets')->name('dbm.asset'); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | Route::put('/relationship', 'RelationController@update'); |
| 45 | 45 | Route::delete('/relationship', 'RelationController@delete'); |
| 46 | 46 | // Table |
| 47 | - Route::group(['prefix' => 'table'], function () { |
|
| 47 | + Route::group(['prefix' => 'table'], function() { |
|
| 48 | 48 | Route::get('/details/{table}', 'RecordController@getTableDetails'); |
| 49 | 49 | Route::get('/columns/{table}', 'TableController@getTableColumns'); |
| 50 | 50 | }); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | Route::group([ |
| 58 | 58 | 'prefix' => 'database', |
| 59 | 59 | 'namespace' => config('dbm.controller_namespace'), |
| 60 | -], function () { |
|
| 60 | +], function() { |
|
| 61 | 61 | // User |
| 62 | 62 | Route::post('/login', 'UserController@login'); |
| 63 | 63 | |
@@ -56,9 +56,9 @@ |
||
| 56 | 56 | */ |
| 57 | 57 | public static function createName($columns, $type, $table = null) |
| 58 | 58 | { |
| 59 | - $table = isset($table) ? trim($table) . '_' : ''; |
|
| 59 | + $table = isset($table) ? trim($table).'_' : ''; |
|
| 60 | 60 | $type = trim($type); |
| 61 | - $name = strtolower($table . implode('_', $columns) . '_' . $type); |
|
| 61 | + $name = strtolower($table.implode('_', $columns).'_'.$type); |
|
| 62 | 62 | |
| 63 | 63 | return str_replace(['-', '.'], '_', $name); |
| 64 | 64 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getNamespace($databaseName, $collectionName) |
| 77 | 77 | { |
| 78 | - return $databaseName . '.' . $collectionName; |
|
| 78 | + return $databaseName.'.'.$collectionName; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $oldName = $collection['oldName']; |
| 163 | 163 | $collectionName = $oldName; |
| 164 | 164 | $connection = config('database.default'); |
| 165 | - $database = config('database.connections.' . $connection . '.database'); |
|
| 165 | + $database = config('database.connections.'.$connection.'.database'); |
|
| 166 | 166 | $fromNs = $this->getNamespace($database, $oldName); |
| 167 | 167 | $toNs = $this->getNamespace($database, $newName); |
| 168 | 168 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function findComposer() |
| 45 | 45 | { |
| 46 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
| 47 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
| 46 | + if (file_exists(getcwd().'/composer.phar')) { |
|
| 47 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
| 48 | 48 | } |
| 49 | 49 | return 'composer'; |
| 50 | 50 | } |
@@ -67,23 +67,23 @@ discard block |
||
| 67 | 67 | $password = config('database.connections.mysql.password', ''); |
| 68 | 68 | |
| 69 | 69 | $driver = dbm_driver(); |
| 70 | - $directory = 'backups' . DIRECTORY_SEPARATOR . $driver; |
|
| 70 | + $directory = 'backups'.DIRECTORY_SEPARATOR.$driver; |
|
| 71 | 71 | |
| 72 | 72 | if ($this->option('path') != null) { |
| 73 | 73 | $path = $this->option('path'); |
| 74 | 74 | } elseif ($this->option('file') != null) { |
| 75 | - $path = $directory . DIRECTORY_SEPARATOR . $this->option('file'); |
|
| 75 | + $path = $directory.DIRECTORY_SEPARATOR.$this->option('file'); |
|
| 76 | 76 | } else { |
| 77 | 77 | $files = array_reverse(Storage::files($directory)); |
| 78 | 78 | $path = $files[0]; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $filePath = storage_path('app') . DIRECTORY_SEPARATOR . $path; |
|
| 81 | + $filePath = storage_path('app').DIRECTORY_SEPARATOR.$path; |
|
| 82 | 82 | $isCompress = config('dbm.backup.compress', false); |
| 83 | 83 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ''); |
| 84 | 84 | $compressCommand = config('dbm.backup.uncompress_command', 'gunzip'); |
| 85 | 85 | $compressExtension = config('dbm.backup.compress_extension', '.gz'); |
| 86 | - $dumpBinaryPath = config('dbm.backup.' . $driver . '.binary_path', ''); |
|
| 86 | + $dumpBinaryPath = config('dbm.backup.'.$driver.'.binary_path', ''); |
|
| 87 | 87 | |
| 88 | 88 | try { |
| 89 | 89 | switch ($driver) { |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function findComposer() |
| 45 | 45 | { |
| 46 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
| 47 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
| 46 | + if (file_exists(getcwd().'/composer.phar')) { |
|
| 47 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
| 48 | 48 | } |
| 49 | 49 | return 'composer'; |
| 50 | 50 | } |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | public function getFileName($table, $database) |
| 53 | 53 | { |
| 54 | 54 | $prefix = (strlen($table) > 0) |
| 55 | - ? 'table_' . strtolower(str_replace('-', '_', $table)) . '_' |
|
| 56 | - : 'database_' . strtolower(str_replace('-', '_', $database)) . '_'; |
|
| 55 | + ? 'table_'.strtolower(str_replace('-', '_', $table)).'_' |
|
| 56 | + : 'database_'.strtolower(str_replace('-', '_', $database)).'_'; |
|
| 57 | 57 | |
| 58 | 58 | $extension = Driver::isMongoDB() ? '' : '.sql'; |
| 59 | - $fileName = $prefix . 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
| 59 | + $fileName = $prefix.'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
| 60 | 60 | |
| 61 | 61 | if (Driver::isSqlite()) { |
| 62 | - $fileName = 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
| 62 | + $fileName = 'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $fileName; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ''); |
| 73 | 73 | $compressCommand = config('dbm.backup.compress_command', 'gzip'); |
| 74 | 74 | $compressExtension = config('dbm.backup.compress_extension', '.gz'); |
| 75 | - $dumpBinaryPath = config('dbm.backup.' . $data['driver'] . '.binary_path', ''); |
|
| 75 | + $dumpBinaryPath = config('dbm.backup.'.$data['driver'].'.binary_path', ''); |
|
| 76 | 76 | |
| 77 | 77 | switch ($data['driver']) { |
| 78 | 78 | case 'mysql': |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | $this->info('Start Database Backup'); |
| 116 | 116 | |
| 117 | 117 | $driver = dbm_driver(); |
| 118 | - $database = config('database.connections.' . $driver . '.database', 'dbm'); |
|
| 118 | + $database = config('database.connections.'.$driver.'.database', 'dbm'); |
|
| 119 | 119 | $table = ($this->option('table') != null) ? $this->option('table') : ''; |
| 120 | 120 | |
| 121 | 121 | try { |
| 122 | 122 | $directory = (config('dbm.backup.dir', 'backups') != '') |
| 123 | 123 | ? DIRECTORY_SEPARATOR . config('dbm.backup.dir', 'backups') |
| 124 | 124 | : ''; |
| 125 | - $directoryPath = storage_path('app') . $directory . DIRECTORY_SEPARATOR . $driver; |
|
| 126 | - $filePath = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database); |
|
| 125 | + $directoryPath = storage_path('app').$directory.DIRECTORY_SEPARATOR.$driver; |
|
| 126 | + $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
|
| 127 | 127 | |
| 128 | 128 | if (!File::isDirectory($directoryPath)) { |
| 129 | 129 | File::makeDirectory($directoryPath, 0777, true, true); |