@@ -171,7 +171,7 @@ |
||
| 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 | |
@@ -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 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function generateModelName($className) |
| 82 | 82 | { |
| 83 | - return static::getModelNamespace() . '\\' . ucfirst(Str::singular($className)); |
|
| 83 | + return static::getModelNamespace().'\\'.ucfirst(Str::singular($className)); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function makeModel($model, $table) |
@@ -93,27 +93,27 @@ discard block |
||
| 93 | 93 | $namespace = implode("\\", $partials); |
| 94 | 94 | |
| 95 | 95 | $contents = "<?php\n\n"; |
| 96 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
| 96 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
| 97 | 97 | if (Driver::isMongoDB()) { |
| 98 | 98 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
| 99 | 99 | } else { |
| 100 | 100 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
| 101 | 101 | } |
| 102 | - $contents .= "class " . $className . " extends Model\n"; |
|
| 102 | + $contents .= "class ".$className." extends Model\n"; |
|
| 103 | 103 | $contents .= "{\n\n"; |
| 104 | 104 | if (Driver::isMongoDB()) { |
| 105 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
| 105 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
| 106 | 106 | } else { |
| 107 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
| 107 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // $content .= "\tpublic \$timestamps = false;\n"; |
| 111 | 111 | $contents .= "}\n"; |
| 112 | 112 | |
| 113 | 113 | $filesystem = new Filesystem; |
| 114 | - $filesystem->put(base_path($model . ".php"), $contents); |
|
| 114 | + $filesystem->put(base_path($model.".php"), $contents); |
|
| 115 | 115 | } catch (\Exception $e) { |
| 116 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
| 116 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'name' => $controller, |
| 127 | 127 | ]); |
| 128 | 128 | } catch (\Exception $e) { |
| 129 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
| 129 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | case 'not_authorized': |
| 280 | 280 | return response()->json([ |
| 281 | 281 | 'success' => false, |
| 282 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
| 282 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
| 283 | 283 | ], 401); |
| 284 | 284 | break; |
| 285 | 285 | case 'authorized': |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $prefix = (Driver::isMongoDB()) ? "_" : ""; |
| 36 | 36 | |
| 37 | 37 | foreach ($fields as $fld) { |
| 38 | - if ($fld->id == $field->{$prefix . "id"}) { |
|
| 38 | + if ($fld->id == $field->{$prefix."id"}) { |
|
| 39 | 39 | |
| 40 | 40 | $relationship = $fld->settings; |
| 41 | 41 | $localTable = $relationship['localTable']; |
@@ -260,7 +260,7 @@ |
||
| 260 | 260 | 'name' => $column['name']])->first()) { |
| 261 | 261 | return response()->json([ |
| 262 | 262 | 'success' => false, |
| 263 | - 'errors' => ["Field name must be unique. " . $column['name'] . " are duplicate"], |
|
| 263 | + 'errors' => ["Field name must be unique. ".$column['name']." are duplicate"], |
|
| 264 | 264 | ], 400); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if (DBM::Template()->where('name', $field['name'])->first()) { |
| 40 | 40 | return response()->json([ |
| 41 | 41 | 'success' => false, |
| 42 | - 'errors' => [" The template name must be unique. " . $field['name'] . " already exist."], |
|
| 42 | + 'errors' => [" The template name must be unique. ".$field['name']." already exist."], |
|
| 43 | 43 | ], 400); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | return response()->json([ |
| 78 | 78 | 'success' => false, |
| 79 | - 'errors' => ['The template '+$request->name . " not found"], |
|
| 79 | + 'errors' => ['The template '+$request->name." not found"], |
|
| 80 | 80 | ], 400); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -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 | }); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | Route::group([ |
| 60 | 60 | 'prefix' => 'database', |
| 61 | 61 | 'namespace' => config('dbm.controller_namespace'), |
| 62 | -], function () { |
|
| 62 | +], function() { |
|
| 63 | 63 | // User |
| 64 | 64 | Route::post('/login', 'UserController@login'); |
| 65 | 65 | Route::post('/oauth/token', 'UserController@getPersonalAccessToken'); |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $files = $request->file($column); |
| 61 | 61 | $values = []; |
| 62 | 62 | foreach ($files as $file) { |
| 63 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
| 64 | - $path = 'public/dbm/' . $tableName; |
|
| 63 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
| 64 | + $path = 'public/dbm/'.$tableName; |
|
| 65 | 65 | $file->storeAs($path, $fileName); |
| 66 | 66 | $values[] = $fileName; |
| 67 | 67 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $fieldType = $this->getFieldType($tableName, $column); |
| 94 | 94 | |
| 95 | 95 | if (!in_array($fieldType, Type::getTypes())) { |
| 96 | - $this->generateError([$fieldType . " type not supported."]); |
|
| 96 | + $this->generateError([$fieldType." type not supported."]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $table->{$column} = Type::$fieldType($value); |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | $files = $request->file($column); |
| 235 | 235 | $values = []; |
| 236 | 236 | foreach ($files as $file) { |
| 237 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
| 238 | - $path = 'public/dbm/' . $tableName; |
|
| 237 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
| 238 | + $path = 'public/dbm/'.$tableName; |
|
| 239 | 239 | $file->storeAs($path, $fileName); |
| 240 | 240 | $values[] = $fileName; |
| 241 | 241 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $fieldType = $this->getFieldType($tableName, $column); |
| 269 | 269 | |
| 270 | 270 | if (!in_array($fieldType, Type::getTypes())) { |
| 271 | - $this->generateError([$fieldType . " type not supported."]); |
|
| 271 | + $this->generateError([$fieldType." type not supported."]); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $table->{$column} = Type::$fieldType($value); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | if (!empty($query) && !empty($searchColumn)) { |
| 475 | 475 | $records = DBM::model($model, $tableName) |
| 476 | - ->where($searchColumn, 'LIKE', '%' . $query . '%') |
|
| 476 | + ->where($searchColumn, 'LIKE', '%'.$query.'%') |
|
| 477 | 477 | ->paginate($perPage); |
| 478 | 478 | } |
| 479 | 479 | |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | } else if ($action == 'update' && isset($settings->update)) { |
| 119 | 119 | $updateSettings = $settings->update; |
| 120 | 120 | $localKey = $updateSettings->localKey; |
| 121 | - $rules = $updateSettings->rules . ',' . $columns->{$localKey}; |
|
| 121 | + $rules = $updateSettings->rules.','.$columns->{$localKey}; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return $rules; |