@@ -68,9 +68,9 @@ |
||
68 | 68 | */ |
69 | 69 | public static function createName($columns, $type, $table = null) |
70 | 70 | { |
71 | - $table = isset($table) ? trim($table) . '_' : ''; |
|
71 | + $table = isset($table) ? trim($table).'_' : ''; |
|
72 | 72 | $type = trim($type); |
73 | - $name = strtolower($table . implode('_', $columns) . '_' . $type); |
|
73 | + $name = strtolower($table.implode('_', $columns).'_'.$type); |
|
74 | 74 | |
75 | 75 | return str_replace(['-', '.'], '_', $name); |
76 | 76 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | class DatabaseManagerSeeder extends Seeder |
6 | 6 | { |
7 | - protected $seedersPath = __DIR__ . '/../../database/seeds/'; |
|
7 | + protected $seedersPath = __DIR__.'/../../database/seeds/'; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Seed the application's database. |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | foreach ($seeds as $class) { |
21 | 21 | |
22 | - $file = $this->seedersPath . $class . '.php'; |
|
22 | + $file = $this->seedersPath.$class.'.php'; |
|
23 | 23 | if (file_exists($file) && !class_exists($class)) { |
24 | 24 | require_once $file; |
25 | 25 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $files = $request->file($column); |
44 | 44 | $values = []; |
45 | 45 | foreach ($files as $file) { |
46 | - $fileName = Str::random(config('dbm.filesystem.random_length')) . '.' . $file->getClientOriginalExtension(); |
|
47 | - $path = trim(config('dbm.filesystem.dir'), '/') . DIRECTORY_SEPARATOR . $tableName; |
|
46 | + $fileName = Str::random(config('dbm.filesystem.random_length')).'.'.$file->getClientOriginalExtension(); |
|
47 | + $path = trim(config('dbm.filesystem.dir'), '/').DIRECTORY_SEPARATOR.$tableName; |
|
48 | 48 | $file->storeAs($path, $fileName); |
49 | 49 | $values[] = $fileName; |
50 | 50 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $fieldType = $this->getFieldType($tableName, $column); |
79 | 79 | |
80 | 80 | if (!in_array($fieldType, Type::getTypes())) { |
81 | - $this->generateError([$fieldType . " type not supported."]); |
|
81 | + $this->generateError([$fieldType." type not supported."]); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if ($fieldType != 'timestamp') { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $rules = $updateSettings->rules; |
253 | 253 | if (isset($updateSettings->localKey)) { |
254 | 254 | $localKey = $updateSettings->localKey; |
255 | - $rules = $updateSettings->rules . ',' . $columns->{$localKey}; |
|
255 | + $rules = $updateSettings->rules.','.$columns->{$localKey}; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 |
@@ -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 | }); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | Route::group([ |
58 | 58 | 'prefix' => 'database', |
59 | 59 | 'namespace' => config('dbm.controller_namespace'), |
60 | -], function () { |
|
60 | +], function() { |
|
61 | 61 | // User |
62 | 62 | Route::post('/login', 'UserController@login'); |
63 | 63 | }); |
@@ -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 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | case 'not_authorized': |
364 | 364 | return response()->json([ |
365 | 365 | 'success' => false, |
366 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
366 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
367 | 367 | ], 401); |
368 | 368 | break; |
369 | 369 | case 'authorized': |
@@ -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 = storage_path('app') . $directory . DIRECTORY_SEPARATOR . $driver; |
|
134 | - $filePath = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database); |
|
133 | + $directoryPath = storage_path('app').$directory.DIRECTORY_SEPARATOR.$driver; |
|
134 | + $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
|
135 | 135 | |
136 | 136 | if (!File::isDirectory($directoryPath)) { |
137 | 137 |
@@ -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 = storage_path('app') . DIRECTORY_SEPARATOR . $path; |
|
82 | + $filePath = storage_path('app').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 | { |
@@ -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 | }); |
@@ -80,11 +80,11 @@ |
||
80 | 80 | |
81 | 81 | if (!empty($query)) { |
82 | 82 | $users = DBM::model($user_model, $user_table) |
83 | - ->where('name', 'LIKE', '%' . $query . '%') |
|
83 | + ->where('name', 'LIKE', '%'.$query.'%') |
|
84 | 84 | ->paginate($perPage); |
85 | 85 | } |
86 | 86 | |
87 | - $users->getCollection()->transform(function ($user) use ($user_display_name) { |
|
87 | + $users->getCollection()->transform(function($user) use ($user_display_name) { |
|
88 | 88 | $user->permissions = DBM::Object() |
89 | 89 | ->setManyToManyRelation( |
90 | 90 | $user, |