@@ -20,7 +20,7 @@ |
||
20 | 20 | $dsn = config('database.connections.mongodb.dsn'); |
21 | 21 | |
22 | 22 | if (!$dsn) { |
23 | - $dsn = 'mongodb://' . $host . ':' . $port . ($auth_db ? "/" . $auth_db : ''); |
|
23 | + $dsn = 'mongodb://'.$host.':'.$port.($auth_db ? "/".$auth_db : ''); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | self::$connection = new Client($dsn); |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | { |
24 | 24 | public function webRoutes() |
25 | 25 | { |
26 | - require __DIR__ . '/../routes/web.php'; |
|
26 | + require __DIR__.'/../routes/web.php'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function apiRoutes() |
30 | 30 | { |
31 | - require __DIR__ . '/../routes/api.php'; |
|
31 | + require __DIR__.'/../routes/api.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function assets($path) |
42 | 42 | { |
43 | - $file = base_path(trim(config('dbm.resources_path'), '/') . "/" . urldecode($path)); |
|
43 | + $file = base_path(trim(config('dbm.resources_path'), '/')."/".urldecode($path)); |
|
44 | 44 | |
45 | 45 | if (File::exists($file)) { |
46 | 46 | |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | $namespace = implode("\\", $partials); |
84 | 84 | |
85 | 85 | $contents = "<?php\n\n"; |
86 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
86 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
87 | 87 | if (Driver::isMongoDB()) { |
88 | 88 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
89 | 89 | } else { |
90 | 90 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
91 | 91 | } |
92 | - $contents .= "class " . $className . " extends Model\n"; |
|
92 | + $contents .= "class ".$className." extends Model\n"; |
|
93 | 93 | $contents .= "{\n\n"; |
94 | 94 | if (Driver::isMongoDB()) { |
95 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
95 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
96 | 96 | } else { |
97 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
97 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // $content .= "\tpublic \$timestamps = false;\n"; |
101 | 101 | $contents .= "}\n"; |
102 | 102 | |
103 | 103 | $filesystem = new Filesystem; |
104 | - $filesystem->put(base_path($model . ".php"), $contents); |
|
104 | + $filesystem->put(base_path($model.".php"), $contents); |
|
105 | 105 | } catch (\Exception $e) { |
106 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
106 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'name' => $controller, |
117 | 117 | ]); |
118 | 118 | } catch (\Exception $e) { |
119 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
119 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
120 | 120 | |
121 | 121 | } |
122 | 122 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | case 'not_authorized': |
270 | 270 | return response()->json([ |
271 | 271 | 'success' => false, |
272 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
272 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
273 | 273 | ], 401); |
274 | 274 | break; |
275 | 275 | case 'authorized': |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function boot() |
30 | 30 | { |
31 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
32 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'dbm'); |
|
31 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
32 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'dbm'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // }); |
45 | 45 | $database = $this->app->config['database']; |
46 | 46 | |
47 | - $this->app->bind(Dumper::class, function ($app) use ($database) { |
|
47 | + $this->app->bind(Dumper::class, function($app) use ($database) { |
|
48 | 48 | $connection = $database['default']; |
49 | 49 | $options = [ |
50 | 50 | "host" => $database["connections"][$connection]["host"] ?? '', |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $this->mergeConfigFrom( |
92 | - __DIR__ . '/../config/dbm.php', 'config' |
|
92 | + __DIR__.'/../config/dbm.php', 'config' |
|
93 | 93 | ); |
94 | 94 | $this->loadHelpers(); |
95 | 95 | $this->registerPublish(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function loadHelpers() |
100 | 100 | { |
101 | - foreach (glob(__DIR__ . '/Helpers/*.php') as $filename) { |
|
101 | + foreach (glob(__DIR__.'/Helpers/*.php') as $filename) { |
|
102 | 102 | require_once $filename; |
103 | 103 | } |
104 | 104 | } |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | { |
108 | 108 | $publishable = [ |
109 | 109 | 'dbm.config' => [ |
110 | - __DIR__ . '/../config/dbm.php' => config_path('dbm.php'), |
|
110 | + __DIR__.'/../config/dbm.php' => config_path('dbm.php'), |
|
111 | 111 | ], |
112 | 112 | 'dbm.seeds' => [ |
113 | - __DIR__ . "/../database/seeds/" => database_path('seeds'), |
|
113 | + __DIR__."/../database/seeds/" => database_path('seeds'), |
|
114 | 114 | ], |
115 | 115 | 'dbm.views' => [ |
116 | - __DIR__ . '/../resources/views' => resource_path('views/vendor/dbm/views'), |
|
116 | + __DIR__.'/../resources/views' => resource_path('views/vendor/dbm/views'), |
|
117 | 117 | ], |
118 | 118 | 'dbm.resources' => [ |
119 | - __DIR__ . '/../resources' => resource_path('views/vendor/dbm'), |
|
119 | + __DIR__.'/../resources' => resource_path('views/vendor/dbm'), |
|
120 | 120 | ], |
121 | 121 | ]; |
122 | 122 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | { |
72 | 72 | $provider = config('auth.guards.api.provider'); |
73 | 73 | |
74 | - return $this->belongsTo(config('auth.providers.' . $provider . '.model')); |
|
74 | + return $this->belongsTo(config('auth.providers.'.$provider.'.model')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -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 | } |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | $password = config('database.connections.mysql.password', ''); |
69 | 69 | |
70 | 70 | $driver = dbm_driver(); |
71 | - $directory = 'backups' . DIRECTORY_SEPARATOR . $driver; |
|
71 | + $directory = 'backups'.DIRECTORY_SEPARATOR.$driver; |
|
72 | 72 | |
73 | 73 | if ($this->option('path') != null) { |
74 | 74 | $path = $this->option('path'); |
75 | 75 | } else if ($this->option('file') != null) { |
76 | - $path = $directory . DIRECTORY_SEPARATOR . $this->option('file'); |
|
76 | + $path = $directory.DIRECTORY_SEPARATOR.$this->option('file'); |
|
77 | 77 | } else { |
78 | 78 | $files = array_reverse(Storage::files($directory)); |
79 | 79 | $path = $files[0]; |
80 | 80 | } |
81 | 81 | |
82 | - $filePath = DBM::getPathPrefix() . DIRECTORY_SEPARATOR . $path; |
|
82 | + $filePath = DBM::getPathPrefix().DIRECTORY_SEPARATOR.$path; |
|
83 | 83 | |
84 | 84 | $isCompress = config('dbm.backup.compress', false); |
85 | 85 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ""); |
86 | 86 | $compressCommand = config('dbm.backup.uncompress_command', "gunzip"); |
87 | 87 | $compressExtension = config('dbm.backup.compress_extension', ".gz"); |
88 | - $dumpBinaryPath = config('dbm.backup.' . $driver . '.binary_path', ''); |
|
88 | + $dumpBinaryPath = config('dbm.backup.'.$driver.'.binary_path', ''); |
|
89 | 89 | |
90 | 90 | try |
91 | 91 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $seedersPath = __DIR__ . '/../../database/seeds/'; |
|
29 | + protected $seedersPath = __DIR__.'/../../database/seeds/'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Get Option |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function findComposer() |
49 | 49 | { |
50 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
51 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
50 | + if (file_exists(getcwd().'/composer.phar')) { |
|
51 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
52 | 52 | } |
53 | 53 | return 'composer'; |
54 | 54 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $this->info('Dumping the autoloaded files and reloading all new files'); |
74 | 74 | $composer = $this->findComposer(); |
75 | - $process = new Process($composer . ' dump-autoload'); |
|
75 | + $process = new Process($composer.' dump-autoload'); |
|
76 | 76 | $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
77 | 77 | $process->setWorkingDirectory(base_path())->run(); |
78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // Seeding Dummy Data |
97 | 97 | $class = 'DatabaseManagerSeeder'; |
98 | - $file = $this->seedersPath . $class . '.php'; |
|
98 | + $file = $this->seedersPath.$class.'.php'; |
|
99 | 99 | |
100 | 100 | if (file_exists($file) && !class_exists($class)) { |
101 | 101 | require_once $file; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | $userPermissions = DBM::userPermissions(); |
28 | 28 | $driver = dbm_driver(); |
29 | - $directory = 'backups' . DIRECTORY_SEPARATOR . $driver; |
|
29 | + $directory = 'backups'.DIRECTORY_SEPARATOR.$driver; |
|
30 | 30 | $files = array_reverse(Storage::files($directory)); |
31 | 31 | $results = []; |
32 | 32 | foreach ($files as $file) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $modelName = ucfirst(Str::singular($object->name)); |
95 | 95 | |
96 | - $model = $namespace . '\\' . $modelName; |
|
96 | + $model = $namespace.'\\'.$modelName; |
|
97 | 97 | $object->model = $model; |
98 | 98 | } else { |
99 | 99 | $model = $object->model; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $table = Table::getTable($tableName); |
108 | 108 | |
109 | 109 | $modelName = ucfirst(Str::singular($table['name'])); |
110 | - $model = $namespace . '\\' . $modelName; |
|
110 | + $model = $namespace.'\\'.$modelName; |
|
111 | 111 | |
112 | 112 | $object = new \stdClass; |
113 | 113 | $object->name = $table['name']; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } else if ($table['makeModel'] == false && !class_exists($table['model'])) { |
206 | 206 | return response()->json([ |
207 | 207 | 'success' => false, |
208 | - 'errors' => ["Create model '" . $table['model'] . "' first or checked create model option"], |
|
208 | + 'errors' => ["Create model '".$table['model']."' first or checked create model option"], |
|
209 | 209 | ], 400); |
210 | 210 | } |
211 | 211 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if ($table['makeModel'] == true) { |
272 | 272 | \DBM::makeModel($table['model'], $table['name']); |
273 | 273 | } else if ($table['makeModel'] == false && !class_exists($table['model'])) { |
274 | - return $this->generateError(["Create mode '" . $table['model'] . "' first."]); |
|
274 | + return $this->generateError(["Create mode '".$table['model']."' first."]); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | if (!class_exists($table['controller'])) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $prefix = (Driver::isMongoDB()) ? "_" : ""; |
370 | 370 | |
371 | 371 | foreach ($fields as $fld) { |
372 | - if ($fld->id == $field->{$prefix . "id"}) { |
|
372 | + if ($fld->id == $field->{$prefix."id"}) { |
|
373 | 373 | |
374 | 374 | $relationship = $fld->settings; |
375 | 375 | $localTable = $relationship['localTable']; |
@@ -403,17 +403,17 @@ discard block |
||
403 | 403 | |
404 | 404 | if (!class_exists($relationship['localModel'])) { |
405 | 405 | |
406 | - $error = $relationship['localModel'] . " Model not found. Please create the " . $relationship['localModel'] . " model first"; |
|
406 | + $error = $relationship['localModel']." Model not found. Please create the ".$relationship['localModel']." model first"; |
|
407 | 407 | return $this->generateError([$error]); |
408 | 408 | } |
409 | 409 | |
410 | 410 | if (!class_exists($relationship['foreignModel'])) { |
411 | 411 | |
412 | - $error = $relationship['foreignModel'] . " Model not found. Please create the " . $relationship['foreignModel'] . " model first"; |
|
412 | + $error = $relationship['foreignModel']." Model not found. Please create the ".$relationship['foreignModel']." model first"; |
|
413 | 413 | return $this->generateError([$error]); |
414 | 414 | } |
415 | 415 | |
416 | - $fieldName = strtolower(Str::singular($relationship['localTable']) . '_' . $relationship['type'] . '_' . Str::singular($relationship['foreignTable']) . '_relationship'); |
|
416 | + $fieldName = strtolower(Str::singular($relationship['localTable']).'_'.$relationship['type'].'_'.Str::singular($relationship['foreignTable']).'_relationship'); |
|
417 | 417 | $settings = [ |
418 | 418 | 'relationType' => $relationship['type'], |
419 | 419 | 'localModel' => $relationship['localModel'], |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | $files = $request->file($column); |
62 | 62 | $values = []; |
63 | 63 | foreach ($files as $file) { |
64 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
65 | - $path = 'public/dbm/' . $tableName; |
|
64 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
65 | + $path = 'public/dbm/'.$tableName; |
|
66 | 66 | $file->storeAs($path, $fileName); |
67 | 67 | $values[] = $fileName; |
68 | 68 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $fieldType = $this->getFieldType($tableName, $column); |
95 | 95 | |
96 | 96 | if (!in_array($fieldType, Type::getTypes())) { |
97 | - $this->generateError([$fieldType . " type not supported."]); |
|
97 | + $this->generateError([$fieldType." type not supported."]); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $table->{$column} = Type::$fieldType($value); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | $files = $request->file($column); |
236 | 236 | $values = []; |
237 | 237 | foreach ($files as $file) { |
238 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
239 | - $path = 'public/dbm/' . $tableName; |
|
238 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
239 | + $path = 'public/dbm/'.$tableName; |
|
240 | 240 | $file->storeAs($path, $fileName); |
241 | 241 | $values[] = $fileName; |
242 | 242 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $fieldType = $this->getFieldType($tableName, $column); |
270 | 270 | |
271 | 271 | if (!in_array($fieldType, Type::getTypes())) { |
272 | - $this->generateError([$fieldType . " type not supported."]); |
|
272 | + $this->generateError([$fieldType." type not supported."]); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | $table->{$column} = Type::$fieldType($value); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | if (!empty($query) && !empty($searchColumn)) { |
536 | 536 | $records = DBM::model($model, $tableName) |
537 | - ->where($searchColumn, 'LIKE', '%' . $query . '%') |
|
537 | + ->where($searchColumn, 'LIKE', '%'.$query.'%') |
|
538 | 538 | ->paginate($perPage); |
539 | 539 | } |
540 | 540 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | } else if ($action == 'update' && isset($validationSettings->update)) { |
671 | 671 | $updateSettings = $validationSettings->update; |
672 | 672 | $localKey = $updateSettings->localKey; |
673 | - $rules = $updateSettings->rules . ',' . $columns->{$localKey}; |
|
673 | + $rules = $updateSettings->rules.','.$columns->{$localKey}; |
|
674 | 674 | } else if (isset($field->settings->validation) && is_string($validationSettings)) { |
675 | 675 | $rules = $validationSettings; |
676 | 676 | } else { |