@@ -178,7 +178,7 @@ |
||
| 178 | 178 | 'name' => $column['name']])->first()) { |
| 179 | 179 | return response()->json([ |
| 180 | 180 | 'success' => false, |
| 181 | - 'errors' => ["Field name must be unique. " . $column['name'] . " are duplicate"], |
|
| 181 | + 'errors' => ["Field name must be unique. ".$column['name']." are duplicate"], |
|
| 182 | 182 | ], 400); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $prefix = (Driver::isMongoDB()) ? "_" : ""; |
| 48 | 48 | |
| 49 | 49 | foreach ($fields as $fld) { |
| 50 | - if ($fld->id == $field->{$prefix . "id"}) { |
|
| 50 | + if ($fld->id == $field->{$prefix."id"}) { |
|
| 51 | 51 | |
| 52 | 52 | $relationship = $fld->settings; |
| 53 | 53 | $localTable = $relationship['localTable']; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $columns = $request->fields; |
| 33 | 33 | $permission = $request->isCrudExists ? 'update' : 'create'; |
| 34 | 34 | |
| 35 | - if (($response = DBM::authorize('crud.' . $permission)) !== true) { |
|
| 35 | + if (($response = DBM::authorize('crud.'.$permission)) !== true) { |
|
| 36 | 36 | return $response; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | if (DBM::Template()->where('name', $field['name'])->first()) { |
| 49 | 49 | return response()->json([ |
| 50 | 50 | 'success' => false, |
| 51 | - 'errors' => [" The template name must be unique. " . $field['name'] . " already exist."], |
|
| 51 | + 'errors' => [" The template name must be unique. ".$field['name']." already exist."], |
|
| 52 | 52 | ], 400); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | return response()->json([ |
| 91 | 91 | 'success' => false, |
| 92 | - 'errors' => ['The template '+$request->name . " not found"], |
|
| 92 | + 'errors' => ['The template '+$request->name." not found"], |
|
| 93 | 93 | ], 400); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -62,12 +62,12 @@ |
||
| 62 | 62 | public function getPaginateFiles(Request $request) |
| 63 | 63 | { |
| 64 | 64 | $driver = dbm_driver(); |
| 65 | - $directory = 'backups' . DIRECTORY_SEPARATOR . $driver; |
|
| 65 | + $directory = 'backups'.DIRECTORY_SEPARATOR.$driver; |
|
| 66 | 66 | $files = collect(Storage::allFiles($directory)); |
| 67 | 67 | |
| 68 | 68 | $query = $request->q; |
| 69 | 69 | if (!empty($query)) { |
| 70 | - $files = $files->filter(function ($file) use ($query) { |
|
| 70 | + $files = $files->filter(function($file) use ($query) { |
|
| 71 | 71 | $info = pathinfo($file); |
| 72 | 72 | return false !== stristr($info['basename'], $query); |
| 73 | 73 | }); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function boot() |
| 31 | 31 | { |
| 32 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
| 33 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'dbm'); |
|
| 32 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
| 33 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'dbm'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $database = $this->app->config['database']; |
| 44 | 44 | // Bind Dumper to backup and and restore |
| 45 | - $this->app->bind(Dumper::class, function ($app) use ($database) { |
|
| 45 | + $this->app->bind(Dumper::class, function($app) use ($database) { |
|
| 46 | 46 | $connection = $database['default']; |
| 47 | 47 | $options = [ |
| 48 | 48 | "host" => $database["connections"][$connection]["host"] ?? '', |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $this->mergeConfigFrom( |
| 90 | - __DIR__ . '/../config/dbm.php', 'config' |
|
| 90 | + __DIR__.'/../config/dbm.php', 'config' |
|
| 91 | 91 | ); |
| 92 | 92 | $this->loadHelpers(); |
| 93 | 93 | $this->registerPublish(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function loadHelpers() |
| 103 | 103 | { |
| 104 | - foreach (glob(__DIR__ . '/Helpers/*.php') as $filename) { |
|
| 104 | + foreach (glob(__DIR__.'/Helpers/*.php') as $filename) { |
|
| 105 | 105 | require_once $filename; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -115,16 +115,16 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $publishable = [ |
| 117 | 117 | 'dbm.config' => [ |
| 118 | - __DIR__ . '/../config/dbm.php' => config_path('dbm.php'), |
|
| 118 | + __DIR__.'/../config/dbm.php' => config_path('dbm.php'), |
|
| 119 | 119 | ], |
| 120 | 120 | 'dbm.seeds' => [ |
| 121 | - __DIR__ . "/../database/seeds/" => database_path('seeds'), |
|
| 121 | + __DIR__."/../database/seeds/" => database_path('seeds'), |
|
| 122 | 122 | ], |
| 123 | 123 | 'dbm.views' => [ |
| 124 | - __DIR__ . '/../resources/views' => resource_path('views/vendor/dbm/views'), |
|
| 124 | + __DIR__.'/../resources/views' => resource_path('views/vendor/dbm/views'), |
|
| 125 | 125 | ], |
| 126 | 126 | 'dbm.resources' => [ |
| 127 | - __DIR__ . '/../resources' => resource_path('views/vendor/dbm'), |
|
| 127 | + __DIR__.'/../resources' => resource_path('views/vendor/dbm'), |
|
| 128 | 128 | ], |
| 129 | 129 | ]; |
| 130 | 130 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function webRoutes() |
| 31 | 31 | { |
| 32 | - require __DIR__ . '/../routes/web.php'; |
|
| 32 | + require __DIR__.'/../routes/web.php'; |
|
| 33 | 33 | } |
| 34 | 34 | /** |
| 35 | 35 | * Include API routes. |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function apiRoutes() |
| 40 | 40 | { |
| 41 | - require __DIR__ . '/../routes/api.php'; |
|
| 41 | + require __DIR__.'/../routes/api.php'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function assets($path) |
| 52 | 52 | { |
| 53 | - $file = base_path(trim(config('dbm.resources_path'), '/') . "/" . urldecode($path)); |
|
| 53 | + $file = base_path(trim(config('dbm.resources_path'), '/')."/".urldecode($path)); |
|
| 54 | 54 | |
| 55 | 55 | if (File::exists($file)) { |
| 56 | 56 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function generateModelName($className) |
| 101 | 101 | { |
| 102 | - return static::getModelNamespace() . '\\' . ucfirst(Str::singular($className)); |
|
| 102 | + return static::getModelNamespace().'\\'.ucfirst(Str::singular($className)); |
|
| 103 | 103 | } |
| 104 | 104 | /** |
| 105 | 105 | * Make new model. |
@@ -120,39 +120,39 @@ discard block |
||
| 120 | 120 | $app = array_shift($partials); |
| 121 | 121 | $directory = implode(DIRECTORY_SEPARATOR, $partials); |
| 122 | 122 | if (strtolower($app) != 'app') { |
| 123 | - $namespace = "App\\" . $namespace; |
|
| 124 | - $directory = $app . DIRECTORY_SEPARATOR . $directory; |
|
| 123 | + $namespace = "App\\".$namespace; |
|
| 124 | + $directory = $app.DIRECTORY_SEPARATOR.$directory; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $path = app_path() . DIRECTORY_SEPARATOR . $directory; |
|
| 127 | + $path = app_path().DIRECTORY_SEPARATOR.$directory; |
|
| 128 | 128 | |
| 129 | 129 | if (!File::isDirectory($path)) { |
| 130 | 130 | File::makeDirectory($path, 0777, true, true); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $contents = "<?php\n\n"; |
| 134 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
| 134 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
| 135 | 135 | if (Driver::isMongoDB()) { |
| 136 | 136 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
| 137 | 137 | } else { |
| 138 | 138 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
| 139 | 139 | } |
| 140 | - $contents .= "class " . $className . " extends Model\n"; |
|
| 140 | + $contents .= "class ".$className." extends Model\n"; |
|
| 141 | 141 | $contents .= "{\n\n"; |
| 142 | 142 | if (Driver::isMongoDB()) { |
| 143 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
| 143 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
| 144 | 144 | } else { |
| 145 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
| 145 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // $content .= "\tpublic \$timestamps = false;\n"; |
| 149 | 149 | $contents .= "}\n"; |
| 150 | 150 | |
| 151 | 151 | $filesystem = new Filesystem; |
| 152 | - $filesystem->put($path . DIRECTORY_SEPARATOR . $className . ".php", $contents); |
|
| 152 | + $filesystem->put($path.DIRECTORY_SEPARATOR.$className.".php", $contents); |
|
| 153 | 153 | |
| 154 | 154 | } catch (\Exception $e) { |
| 155 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
| 155 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | 'name' => $controller, |
| 172 | 172 | ]); |
| 173 | 173 | } catch (\Exception $e) { |
| 174 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
| 174 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | case 'not_authorized': |
| 371 | 371 | return response()->json([ |
| 372 | 372 | 'success' => false, |
| 373 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
| 373 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
| 374 | 374 | ], 401); |
| 375 | 375 | break; |
| 376 | 376 | case 'authorized': |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | switch ($data['driver']) { |
| 79 | 79 | case 'mysql': |
| 80 | 80 | case 'pgsql': |
| 81 | - if (! empty($data['table'])) { |
|
| 81 | + if (!empty($data['table'])) { |
|
| 82 | 82 | $dumper->setTables($data['table']); |
| 83 | 83 | } |
| 84 | 84 | break; |
| 85 | 85 | case 'mongodb': |
| 86 | 86 | $dsn = config('dbm.backup.mongodb.dsn', ''); |
| 87 | - if (! empty($dsn) && method_exists($dumper, 'setUri')) { |
|
| 87 | + if (!empty($dsn) && method_exists($dumper, 'setUri')) { |
|
| 88 | 88 | $dumper->setUri($dsn); |
| 89 | 89 | } |
| 90 | 90 | break; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $directoryPath = storage_path('app').$directory.DIRECTORY_SEPARATOR.$driver; |
| 127 | 127 | $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
| 128 | 128 | |
| 129 | - if (! File::isDirectory($directoryPath)) { |
|
| 129 | + if (!File::isDirectory($directoryPath)) { |
|
| 130 | 130 | File::makeDirectory($directoryPath, 0777, true, true); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -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(); |