@@ -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 @@ |
||
| 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) { |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -Route::group(['prefix' => 'database', 'namespace' => config('dbm.controller_namespace')], function () { |
|
| 2 | +Route::group(['prefix' => 'database', 'namespace' => config('dbm.controller_namespace')], function() { |
|
| 3 | 3 | //Database Table |
| 4 | 4 | Route::get('/', 'DatabaseController@index'); |
| 5 | 5 | Route::get('table/builder/{name}', 'DatabaseController@index'); |
@@ -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 | } |
@@ -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 @@ |
||
| 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': |