@@ -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 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | 'name' => $column['name']])->first()) { |
| 283 | 283 | return response()->json([ |
| 284 | 284 | 'success' => false, |
| 285 | - 'errors' => ["Field name must be unique. " . $column['name'] . " are duplicate"], |
|
| 285 | + 'errors' => ["Field name must be unique. ".$column['name']." are duplicate"], |
|
| 286 | 286 | ], 400); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | if (DBM::Template()->where('name', $field['name'])->first()) { |
| 541 | 541 | return response()->json([ |
| 542 | 542 | 'success' => false, |
| 543 | - 'errors' => [" The template name must be unique. " . $field['name'] . " already exist."], |
|
| 543 | + 'errors' => [" The template name must be unique. ".$field['name']." already exist."], |
|
| 544 | 544 | ], 400); |
| 545 | 545 | } |
| 546 | 546 | |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | return response()->json([ |
| 579 | 579 | 'success' => false, |
| 580 | - 'errors' => ['The template '+$request->name . " not found"], |
|
| 580 | + 'errors' => ['The template '+$request->name." not found"], |
|
| 581 | 581 | ], 400); |
| 582 | 582 | } |
| 583 | 583 | |
@@ -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; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ""); |
| 75 | 75 | $compressCommand = config('dbm.backup.compress_command', "gzip"); |
| 76 | 76 | $compressExtension = config('dbm.backup.compress_extension', ".gz"); |
| 77 | - $dumpBinaryPath = config('dbm.backup.' . $data['driver'] . '.binary_path', ''); |
|
| 77 | + $dumpBinaryPath = config('dbm.backup.'.$data['driver'].'.binary_path', ''); |
|
| 78 | 78 | |
| 79 | 79 | switch ($data['driver']) { |
| 80 | 80 | case 'mysql': |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | // $hostname = config('database.connections.' . $driver . '.host', '127.0.0.1'); |
| 122 | 122 | // $port = config('database.connections.' . $driver . '.port', '3306'); |
| 123 | - $database = config('database.connections.' . $driver . '.database', 'dbm'); |
|
| 123 | + $database = config('database.connections.'.$driver.'.database', 'dbm'); |
|
| 124 | 124 | $table = ($this->option('table') != null) ? $this->option('table') : ''; |
| 125 | 125 | // $username = config('database.connections.' . $driver . '.username', 'root'); |
| 126 | 126 | // $password = config('database.connections.' . $driver . '.password', ''); |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | $directory = (config('dbm.backup.dir', 'backups') != '') |
| 131 | 131 | ? DIRECTORY_SEPARATOR . config('dbm.backup.dir', 'backups') |
| 132 | 132 | : ''; |
| 133 | - $directoryPath = DBM::getPathPrefix() . $directory . DIRECTORY_SEPARATOR . $driver; |
|
| 134 | - $filePath = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database); |
|
| 133 | + $directoryPath = DBM::getPathPrefix().$directory.DIRECTORY_SEPARATOR.$driver; |
|
| 134 | + $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
|
| 135 | 135 | |
| 136 | 136 | if (!File::isDirectory($directoryPath)) { |
| 137 | 137 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $columns = $request->fields; |
| 172 | 172 | $permission = $request->isCrudExists ? 'update' : 'create'; |
| 173 | 173 | |
| 174 | - if (($response = DBM::authorize('crud.' . $permission)) !== true) { |
|
| 174 | + if (($response = DBM::authorize('crud.'.$permission)) !== true) { |
|
| 175 | 175 | return $response; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $prefix = (Driver::isMongoDB()) ? "_" : ""; |
| 316 | 316 | |
| 317 | 317 | foreach ($fields as $fld) { |
| 318 | - if ($fld->id == $field->{$prefix . "id"}) { |
|
| 318 | + if ($fld->id == $field->{$prefix."id"}) { |
|
| 319 | 319 | |
| 320 | 320 | $relationship = $fld->settings; |
| 321 | 321 | $localTable = $relationship['localTable']; |
@@ -349,17 +349,17 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | if (!class_exists($relationship['localModel'])) { |
| 351 | 351 | |
| 352 | - $error = $relationship['localModel'] . " Model not found. Please create the " . $relationship['localModel'] . " model first"; |
|
| 352 | + $error = $relationship['localModel']." Model not found. Please create the ".$relationship['localModel']." model first"; |
|
| 353 | 353 | return $this->generateError([$error]); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if (!class_exists($relationship['foreignModel'])) { |
| 357 | 357 | |
| 358 | - $error = $relationship['foreignModel'] . " Model not found. Please create the " . $relationship['foreignModel'] . " model first"; |
|
| 358 | + $error = $relationship['foreignModel']." Model not found. Please create the ".$relationship['foreignModel']." model first"; |
|
| 359 | 359 | return $this->generateError([$error]); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $fieldName = strtolower(Str::singular($relationship['localTable']) . '_' . $relationship['type'] . '_' . Str::singular($relationship['foreignTable']) . '_relationship'); |
|
| 362 | + $fieldName = strtolower(Str::singular($relationship['localTable']).'_'.$relationship['type'].'_'.Str::singular($relationship['foreignTable']).'_relationship'); |
|
| 363 | 363 | $settings = [ |
| 364 | 364 | 'relationType' => $relationship['type'], |
| 365 | 365 | 'localModel' => $relationship['localModel'], |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | public function webRoutes() |
| 26 | 26 | { |
| 27 | - require __DIR__ . '/../routes/web.php'; |
|
| 27 | + require __DIR__.'/../routes/web.php'; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function apiRoutes() |
| 31 | 31 | { |
| 32 | - require __DIR__ . '/../routes/api.php'; |
|
| 32 | + require __DIR__.'/../routes/api.php'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function assets($path) |
| 43 | 43 | { |
| 44 | - $file = base_path(trim(config('dbm.resources_path'), '/') . "/" . urldecode($path)); |
|
| 44 | + $file = base_path(trim(config('dbm.resources_path'), '/')."/".urldecode($path)); |
|
| 45 | 45 | |
| 46 | 46 | if (File::exists($file)) { |
| 47 | 47 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $modelName = ucfirst(Str::singular($className)); |
| 86 | 86 | |
| 87 | - return $namespace . '\\' . $modelName; |
|
| 87 | + return $namespace.'\\'.$modelName; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function makeModel($model, $table) |
@@ -97,27 +97,27 @@ discard block |
||
| 97 | 97 | $namespace = implode("\\", $partials); |
| 98 | 98 | |
| 99 | 99 | $contents = "<?php\n\n"; |
| 100 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
| 100 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
| 101 | 101 | if (Driver::isMongoDB()) { |
| 102 | 102 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
| 103 | 103 | } else { |
| 104 | 104 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
| 105 | 105 | } |
| 106 | - $contents .= "class " . $className . " extends Model\n"; |
|
| 106 | + $contents .= "class ".$className." extends Model\n"; |
|
| 107 | 107 | $contents .= "{\n\n"; |
| 108 | 108 | if (Driver::isMongoDB()) { |
| 109 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
| 109 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
| 110 | 110 | } else { |
| 111 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
| 111 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // $content .= "\tpublic \$timestamps = false;\n"; |
| 115 | 115 | $contents .= "}\n"; |
| 116 | 116 | |
| 117 | 117 | $filesystem = new Filesystem; |
| 118 | - $filesystem->put(base_path($model . ".php"), $contents); |
|
| 118 | + $filesystem->put(base_path($model.".php"), $contents); |
|
| 119 | 119 | } catch (\Exception $e) { |
| 120 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
| 120 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'name' => $controller, |
| 131 | 131 | ]); |
| 132 | 132 | } catch (\Exception $e) { |
| 133 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
| 133 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | case 'not_authorized': |
| 284 | 284 | return response()->json([ |
| 285 | 285 | 'success' => false, |
| 286 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
| 286 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
| 287 | 287 | ], 401); |
| 288 | 288 | break; |
| 289 | 289 | case 'authorized': |