@@ -39,8 +39,8 @@ |
||
39 | 39 | */ |
40 | 40 | protected function findComposer() |
41 | 41 | { |
42 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
43 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
42 | + if (file_exists(getcwd().'/composer.phar')) { |
|
43 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
44 | 44 | } |
45 | 45 | return 'composer'; |
46 | 46 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getNamespace($databaseName, $collectionName) |
77 | 77 | { |
78 | - return $databaseName . '.' . $collectionName; |
|
78 | + return $databaseName.'.'.$collectionName; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $oldName = $collection['oldName']; |
163 | 163 | $collectionName = $oldName; |
164 | 164 | $connection = config('database.default'); |
165 | - $database = config('database.connections.' . $connection . '.database'); |
|
165 | + $database = config('database.connections.'.$connection.'.database'); |
|
166 | 166 | $fromNs = $this->getNamespace($database, $oldName); |
167 | 167 | $toNs = $this->getNamespace($database, $newName); |
168 | 168 |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function findComposer() |
45 | 45 | { |
46 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
47 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
46 | + if (file_exists(getcwd().'/composer.phar')) { |
|
47 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
48 | 48 | } |
49 | 49 | return 'composer'; |
50 | 50 | } |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | $password = config('database.connections.mysql.password', ''); |
68 | 68 | |
69 | 69 | $driver = dbm_driver(); |
70 | - $directory = 'backups' . DIRECTORY_SEPARATOR . $driver; |
|
70 | + $directory = 'backups'.DIRECTORY_SEPARATOR.$driver; |
|
71 | 71 | |
72 | 72 | if ($this->option('path') != null) { |
73 | 73 | $path = $this->option('path'); |
74 | 74 | } elseif ($this->option('file') != null) { |
75 | - $path = $directory . DIRECTORY_SEPARATOR . $this->option('file'); |
|
75 | + $path = $directory.DIRECTORY_SEPARATOR.$this->option('file'); |
|
76 | 76 | } else { |
77 | 77 | $files = array_reverse(Storage::files($directory)); |
78 | 78 | $path = $files[0]; |
79 | 79 | } |
80 | 80 | |
81 | - $filePath = storage_path('app') . DIRECTORY_SEPARATOR . $path; |
|
81 | + $filePath = storage_path('app').DIRECTORY_SEPARATOR.$path; |
|
82 | 82 | $isCompress = config('dbm.backup.compress', false); |
83 | 83 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ''); |
84 | 84 | $compressCommand = config('dbm.backup.uncompress_command', 'gunzip'); |
85 | 85 | $compressExtension = config('dbm.backup.compress_extension', '.gz'); |
86 | - $dumpBinaryPath = config('dbm.backup.' . $driver . '.binary_path', ''); |
|
86 | + $dumpBinaryPath = config('dbm.backup.'.$driver.'.binary_path', ''); |
|
87 | 87 | |
88 | 88 | try { |
89 | 89 | switch ($driver) { |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function findComposer() |
45 | 45 | { |
46 | - if (file_exists(getcwd() . '/composer.phar')) { |
|
47 | - return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
46 | + if (file_exists(getcwd().'/composer.phar')) { |
|
47 | + return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
48 | 48 | } |
49 | 49 | return 'composer'; |
50 | 50 | } |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | public function getFileName($table, $database) |
53 | 53 | { |
54 | 54 | $prefix = (strlen($table) > 0) |
55 | - ? 'table_' . strtolower(str_replace('-', '_', $table)) . '_' |
|
56 | - : 'database_' . strtolower(str_replace('-', '_', $database)) . '_'; |
|
55 | + ? 'table_'.strtolower(str_replace('-', '_', $table)).'_' |
|
56 | + : 'database_'.strtolower(str_replace('-', '_', $database)).'_'; |
|
57 | 57 | |
58 | 58 | $extension = Driver::isMongoDB() ? '' : '.sql'; |
59 | - $fileName = $prefix . 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
59 | + $fileName = $prefix.'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
60 | 60 | |
61 | 61 | if (Driver::isSqlite()) { |
62 | - $fileName = 'backup_' . date('G_a_m_d_y_h_i_s') . $extension; |
|
62 | + $fileName = 'backup_'.date('G_a_m_d_y_h_i_s').$extension; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $fileName; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $compressBinaryPath = config('dbm.backup.compress_binary_path', ''); |
73 | 73 | $compressCommand = config('dbm.backup.compress_command', 'gzip'); |
74 | 74 | $compressExtension = config('dbm.backup.compress_extension', '.gz'); |
75 | - $dumpBinaryPath = config('dbm.backup.' . $data['driver'] . '.binary_path', ''); |
|
75 | + $dumpBinaryPath = config('dbm.backup.'.$data['driver'].'.binary_path', ''); |
|
76 | 76 | |
77 | 77 | switch ($data['driver']) { |
78 | 78 | case 'mysql': |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | $this->info('Start Database Backup'); |
116 | 116 | |
117 | 117 | $driver = dbm_driver(); |
118 | - $database = config('database.connections.' . $driver . '.database', 'dbm'); |
|
118 | + $database = config('database.connections.'.$driver.'.database', 'dbm'); |
|
119 | 119 | $table = ($this->option('table') != null) ? $this->option('table') : ''; |
120 | 120 | |
121 | 121 | try { |
122 | 122 | $directory = (config('dbm.backup.dir', 'backups') != '') |
123 | 123 | ? DIRECTORY_SEPARATOR . config('dbm.backup.dir', 'backups') |
124 | 124 | : ''; |
125 | - $directoryPath = storage_path('app') . $directory . DIRECTORY_SEPARATOR . $driver; |
|
126 | - $filePath = $directoryPath . DIRECTORY_SEPARATOR . $this->getFileName($table, $database); |
|
125 | + $directoryPath = storage_path('app').$directory.DIRECTORY_SEPARATOR.$driver; |
|
126 | + $filePath = $directoryPath.DIRECTORY_SEPARATOR.$this->getFileName($table, $database); |
|
127 | 127 | |
128 | 128 | if (!File::isDirectory($directoryPath)) { |
129 | 129 | File::makeDirectory($directoryPath, 0777, true, true); |
@@ -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 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function apiRoutes() |
41 | 41 | { |
42 | - require __DIR__ . '/../routes/api.php'; |
|
42 | + require __DIR__.'/../routes/api.php'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function assets($path) |
53 | 53 | { |
54 | - $file = base_path(trim(config('dbm.resources_path'), '/') . "/" . urldecode($path)); |
|
54 | + $file = base_path(trim(config('dbm.resources_path'), '/')."/".urldecode($path)); |
|
55 | 55 | |
56 | 56 | if (File::exists($file)) { |
57 | 57 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function generateModelName($className) |
104 | 104 | { |
105 | - return static::getModelNamespace() . '\\' . ucfirst(Str::singular($className)); |
|
105 | + return static::getModelNamespace().'\\'.ucfirst(Str::singular($className)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -124,39 +124,39 @@ discard block |
||
124 | 124 | $app = array_shift($partials); |
125 | 125 | $directory = implode(DIRECTORY_SEPARATOR, $partials); |
126 | 126 | if (strtolower($app) != 'app') { |
127 | - $namespace = "App\\" . $namespace; |
|
128 | - $directory = $app . DIRECTORY_SEPARATOR . $directory; |
|
127 | + $namespace = "App\\".$namespace; |
|
128 | + $directory = $app.DIRECTORY_SEPARATOR.$directory; |
|
129 | 129 | } |
130 | 130 | |
131 | - $path = app_path() . DIRECTORY_SEPARATOR . $directory; |
|
131 | + $path = app_path().DIRECTORY_SEPARATOR.$directory; |
|
132 | 132 | |
133 | 133 | if (!File::isDirectory($path)) { |
134 | 134 | File::makeDirectory($path, 0777, true, true); |
135 | 135 | } |
136 | 136 | |
137 | 137 | $contents = "<?php\n\n"; |
138 | - $contents .= "namespace " . $namespace . ";\n\n"; |
|
138 | + $contents .= "namespace ".$namespace.";\n\n"; |
|
139 | 139 | if (Driver::isMongoDB()) { |
140 | 140 | $contents .= "use Jenssegers\Mongodb\Eloquent\Model;\n\n"; |
141 | 141 | } else { |
142 | 142 | $contents .= "use Illuminate\Database\Eloquent\Model;\n\n"; |
143 | 143 | } |
144 | - $contents .= "class " . $className . " extends Model\n"; |
|
144 | + $contents .= "class ".$className." extends Model\n"; |
|
145 | 145 | $contents .= "{\n\n"; |
146 | 146 | if (Driver::isMongoDB()) { |
147 | - $contents .= "\tprotected \$collection = '" . $table . "';\n"; |
|
147 | + $contents .= "\tprotected \$collection = '".$table."';\n"; |
|
148 | 148 | } else { |
149 | - $contents .= "\tprotected \$table = '" . $table . "';\n"; |
|
149 | + $contents .= "\tprotected \$table = '".$table."';\n"; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // $content .= "\tpublic \$timestamps = false;\n"; |
153 | 153 | $contents .= "}\n"; |
154 | 154 | |
155 | 155 | $filesystem = new Filesystem; |
156 | - $filesystem->put($path . DIRECTORY_SEPARATOR . $className . ".php", $contents); |
|
156 | + $filesystem->put($path.DIRECTORY_SEPARATOR.$className.".php", $contents); |
|
157 | 157 | |
158 | 158 | } catch (\Exception $e) { |
159 | - throw new \Exception("There has an error when create model. The error is :" . $e->getMessage(), 1); |
|
159 | + throw new \Exception("There has an error when create model. The error is :".$e->getMessage(), 1); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 'name' => $controller, |
176 | 176 | ]); |
177 | 177 | } catch (\Exception $e) { |
178 | - throw new \Exception("There has an error when create Controller. The error is :" . $e->getMessage(), 1); |
|
178 | + throw new \Exception("There has an error when create Controller. The error is :".$e->getMessage(), 1); |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | case 'not_authorized': |
386 | 386 | return response()->json([ |
387 | 387 | 'success' => false, |
388 | - 'errors' => ["You don't have permission to " . $slug . " " . $prefix], |
|
388 | + 'errors' => ["You don't have permission to ".$slug." ".$prefix], |
|
389 | 389 | ], 401); |
390 | 390 | break; |
391 | 391 | case 'authorized': |