@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -Route::group(['prefix' => 'database', 'namespace' => config('dbm.controller_namespace')], function () { |
|
| 2 | +Route::group(['prefix' => 'database', 'namespace' => config('dbm.controller_namespace')], function() { |
|
| 3 | 3 | //Database Table |
| 4 | 4 | Route::get('/', 'DatabaseController@index'); |
| 5 | 5 | Route::get('table/builder/{name}', 'DatabaseController@index'); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::group(['prefix' => config('dbm.prefix'), 'namespace' => config('dbm.controller_namespace')], function () { |
|
| 3 | +Route::group(['prefix' => config('dbm.prefix'), 'namespace' => config('dbm.controller_namespace')], function() { |
|
| 4 | 4 | |
| 5 | 5 | /* Helpers Route*/ |
| 6 | 6 | Route::get('assets', 'ManagerController@assets')->name('dbm.asset'); |
| 7 | 7 | |
| 8 | 8 | // Database |
| 9 | - Route::group(['prefix' => 'database', 'middleware' => 'auth:api'], function () { |
|
| 9 | + Route::group(['prefix' => 'database', 'middleware' => 'auth:api'], function() { |
|
| 10 | 10 | |
| 11 | 11 | // Route::get('/', 'DatabaseController@index')->name('dbm.table'); |
| 12 | 12 | Route::get('/tables', 'DatabaseController@all'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * U = Update/Edit |
| 44 | 44 | * D = Delete |
| 45 | 45 | */ |
| 46 | - Route::group(['prefix' => 'crud', 'middleware' => 'auth:api'], function () { |
|
| 46 | + Route::group(['prefix' => 'crud', 'middleware' => 'auth:api'], function() { |
|
| 47 | 47 | |
| 48 | 48 | // Route::get('/', 'CrudController@index')->name('dbm.crud'); |
| 49 | 49 | Route::get('/tables', 'CrudController@all'); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | - Route::group(['prefix' => 'table', 'middleware' => 'auth:api'], function () { |
|
| 63 | + Route::group(['prefix' => 'table', 'middleware' => 'auth:api'], function() { |
|
| 64 | 64 | |
| 65 | 65 | // Builder |
| 66 | 66 | // Route::get('/builder/{name}', 'DatabaseController@showTableBuilder'); |
@@ -53,9 +53,9 @@ |
||
| 53 | 53 | |
| 54 | 54 | public static function createName(array $columns, $type, $table = null) |
| 55 | 55 | { |
| 56 | - $table = isset($table) ? trim($table) . '_' : ''; |
|
| 56 | + $table = isset($table) ? trim($table).'_' : ''; |
|
| 57 | 57 | $type = trim($type); |
| 58 | - $name = strtolower($table . implode('_', $columns) . '_' . $type); |
|
| 58 | + $name = strtolower($table.implode('_', $columns).'_'.$type); |
|
| 59 | 59 | |
| 60 | 60 | return str_replace(['-', '.'], '_', $name); |
| 61 | 61 | } |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function findComposer() |
| 46 | 46 | { |
| 47 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
| 48 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
| 47 | + if (file_exists(getcwd().'/composer.phar')) { |
|
| 48 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
| 49 | 49 | } |
| 50 | 50 | return 'composer'; |
| 51 | 51 | } |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | |
| 56 | 56 | $prefix = (strlen($table) > 0) |
| 57 | - ? 'table_' . strtolower(str_replace('-', '_', $table)) . "_" |
|
| 58 | - : 'database_' . strtolower(str_replace('-', '_', $database)) . "_"; |
|
| 57 | + ? 'table_'.strtolower(str_replace('-', '_', $table))."_" |
|
| 58 | + : 'database_'.strtolower(str_replace('-', '_', $database))."_"; |
|
| 59 | 59 | |
| 60 | 60 | $extension = Driver::isMongoDB() ? '' : '.sql'; |
| 61 | - $fileName = $prefix . 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
| 61 | + $fileName = $prefix.'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
| 62 | 62 | |
| 63 | 63 | if (Driver::isSqlite()) { |
| 64 | - $fileName = 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
| 64 | + $fileName = 'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $fileName; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // $hostname = config('database.connections.' . $driver . '.host', '127.0.0.1'); |
| 84 | 84 | // $port = config('database.connections.' . $driver . '.port', '3306'); |
| 85 | - $database = config('database.connections.' . $driver . '.database', 'dbm'); |
|
| 85 | + $database = config('database.connections.'.$driver.'.database', 'dbm'); |
|
| 86 | 86 | $table = ($this->option('table') != null) ? $this->option('table') : ''; |
| 87 | 87 | // $username = config('database.connections.' . $driver . '.username', 'root'); |
| 88 | 88 | // $password = config('database.connections.' . $driver . '.password', ''); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $directory = (config('dbm.backup.dir', 'backups') != '') |
| 93 | 93 | ? DIRECTORY_SEPARATOR . config('dbm.backup.dir', 'backups') |
| 94 | 94 | : ''; |
| 95 | - $directoryPath = DBM::getPathPrefix() . $directory . DIRECTORY_SEPARATOR . $driver; |
|
| 96 | - $filePath = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database); |
|
| 95 | + $directoryPath = DBM::getPathPrefix().$directory.DIRECTORY_SEPARATOR.$driver; |
|
| 96 | + $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
|
| 97 | 97 | |
| 98 | 98 | if (!File::isDirectory($directoryPath)) { |
| 99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ""); |
| 107 | 107 | $compressCommand = config('dbm.backup.compress_command', "gzip"); |
| 108 | 108 | $compressExtension = config('dbm.backup.compress_extension', ".gz"); |
| 109 | - $dumpBinaryPath = config('dbm.backup.' . $driver . '.binary_path', ''); |
|
| 109 | + $dumpBinaryPath = config('dbm.backup.'.$driver.'.binary_path', ''); |
|
| 110 | 110 | |
| 111 | 111 | switch ($driver) { |
| 112 | 112 | case 'mysql': |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | 'name' => $column['name']])->first()) { |
| 305 | 305 | return response()->json([ |
| 306 | 306 | 'success' => false, |
| 307 | - 'errors' => ["Field name must be unique. " . $column['name'] . " are duplicate"], |
|
| 307 | + 'errors' => ["Field name must be unique. ".$column['name']." are duplicate"], |
|
| 308 | 308 | ], 400); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | if (DBM::Template()->where('name', $field['name'])->first()) { |
| 537 | 537 | return response()->json([ |
| 538 | 538 | 'success' => false, |
| 539 | - 'errors' => [" The template name must be unique. " . $field['name'] . " already exist."], |
|
| 539 | + 'errors' => [" The template name must be unique. ".$field['name']." already exist."], |
|
| 540 | 540 | ], 400); |
| 541 | 541 | } |
| 542 | 542 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | return response()->json([ |
| 575 | 575 | 'success' => false, |
| 576 | - 'errors' => ['The template '+$request->name . " not found"], |
|
| 576 | + 'errors' => ['The template '+$request->name." not found"], |
|
| 577 | 577 | ], 400); |
| 578 | 578 | } |
| 579 | 579 | |