@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('modules', function (Blueprint $table) { |
|
| 16 | + Schema::create('modules', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name'); |
| 19 | 19 | $table->string('path'); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function generate(): int |
| 30 | 30 | { |
| 31 | - return DB::transaction(function () { |
|
| 31 | + return DB::transaction(function() { |
|
| 32 | 32 | $name = $this->getName(); |
| 33 | 33 | |
| 34 | 34 | if ($this->module->has($name)) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function generateFiles() |
| 83 | 83 | { |
| 84 | 84 | foreach ($this->getFiles() as $stub => $file) { |
| 85 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
| 85 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
| 86 | 86 | |
| 87 | 87 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 88 | 88 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if (GenerateConfigReader::read('provider')->generate() === true) { |
| 115 | 115 | Artisan::call('module:make-provider', [ |
| 116 | - 'name' => $moduleName . 'ServiceProvider', |
|
| 116 | + 'name' => $moduleName.'ServiceProvider', |
|
| 117 | 117 | 'module' => $moduleName, |
| 118 | 118 | '--master' => true, |
| 119 | 119 | ]); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | if (GenerateConfigReader::read('controller')->generate() === true) { |
| 126 | 126 | $options = $this->type == 'api' ? ['--api' => true] : []; |
| 127 | 127 | Artisan::call('module:make-controller', [ |
| 128 | - 'controller' => $moduleName . 'Controller', |
|
| 128 | + 'controller' => $moduleName.'Controller', |
|
| 129 | 129 | 'module' => $moduleName, |
| 130 | 130 | ] + $options); |
| 131 | 131 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | private function generateModuleJsonFile() |
| 138 | 138 | { |
| 139 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 139 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 140 | 140 | |
| 141 | 141 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 142 | 142 | $this->filesystem->makeDirectory($dir, 0775, true); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | continue; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $path = $this->module->getModulePath($this->getName()) . DIRECTORY_SEPARATOR . $folder->getPath(); |
|
| 362 | + $path = $this->module->getModulePath($this->getName()).DIRECTORY_SEPARATOR.$folder->getPath(); |
|
| 363 | 363 | |
| 364 | 364 | $this->filesystem->makeDirectory($path, 0755, true); |
| 365 | 365 | if (config('modules.stubs.gitkeep')) { |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function generateGitKeep($path) |
| 377 | 377 | { |
| 378 | - $this->filesystem->put($path . DIRECTORY_SEPARATOR . '.gitkeep', ''); |
|
| 378 | + $this->filesystem->put($path.DIRECTORY_SEPARATOR.'.gitkeep', ''); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | public function generateFiles() |
| 385 | 385 | { |
| 386 | 386 | foreach ($this->getFiles() as $stub => $file) { |
| 387 | - $path = $this->module->getModulePath($this->getName()) . $file; |
|
| 387 | + $path = $this->module->getModulePath($this->getName()).$file; |
|
| 388 | 388 | |
| 389 | - $this->component->task("Generating file {$path}",function () use ($stub, $path) { |
|
| 389 | + $this->component->task("Generating file {$path}", function() use ($stub, $path) { |
|
| 390 | 390 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 391 | 391 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 392 | 392 | } |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | if (GenerateConfigReader::read('provider')->generate() === true) { |
| 413 | 413 | $this->console->call('module:make-provider', [ |
| 414 | - 'name' => $this->getName() . 'ServiceProvider', |
|
| 414 | + 'name' => $this->getName().'ServiceProvider', |
|
| 415 | 415 | 'module' => $this->getName(), |
| 416 | 416 | '--master' => true, |
| 417 | 417 | ]); |
@@ -421,11 +421,11 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | if (GenerateConfigReader::read('controller')->generate() === true) { |
| 424 | - $options = $this->type=='api' ? ['--api'=>true] : []; |
|
| 424 | + $options = $this->type == 'api' ? ['--api'=>true] : []; |
|
| 425 | 425 | $this->console->call('module:make-controller', [ |
| 426 | - 'controller' => $this->getName() . 'Controller', |
|
| 426 | + 'controller' => $this->getName().'Controller', |
|
| 427 | 427 | 'module' => $this->getName(), |
| 428 | - ]+$options); |
|
| 428 | + ] + $options); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | protected function getStubContents($stub) |
| 440 | 440 | { |
| 441 | 441 | return (new Stub( |
| 442 | - DIRECTORY_SEPARATOR . $stub . '.stub', |
|
| 442 | + DIRECTORY_SEPARATOR.$stub.'.stub', |
|
| 443 | 443 | $this->getReplacement($stub) |
| 444 | 444 | ) |
| 445 | 445 | )->render(); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | } |
| 480 | 480 | foreach ($keys as $key) { |
| 481 | - if (method_exists($this, $method = 'get' . ucfirst(Str::studly(strtolower($key))) . 'Replacement')) { |
|
| 481 | + if (method_exists($this, $method = 'get'.ucfirst(Str::studly(strtolower($key))).'Replacement')) { |
|
| 482 | 482 | $replaces[$key] = $this->$method(); |
| 483 | 483 | } else { |
| 484 | 484 | $replaces[$key] = null; |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | private function generateModuleJsonFile() |
| 495 | 495 | { |
| 496 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 496 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 497 | 497 | |
| 498 | - $this->component->task("Generating file $path",function () use ($path) { |
|
| 498 | + $this->component->task("Generating file $path", function() use ($path) { |
|
| 499 | 499 | if (!$this->filesystem->isDirectory($dir = dirname($path))) { |
| 500 | 500 | $this->filesystem->makeDirectory($dir, 0775, true); |
| 501 | 501 | } |
@@ -510,13 +510,13 @@ discard block |
||
| 510 | 510 | */ |
| 511 | 511 | private function cleanModuleJsonFile() |
| 512 | 512 | { |
| 513 | - $path = $this->module->getModulePath($this->getName()) . 'module.json'; |
|
| 513 | + $path = $this->module->getModulePath($this->getName()).'module.json'; |
|
| 514 | 514 | |
| 515 | 515 | $content = $this->filesystem->get($path); |
| 516 | 516 | $namespace = $this->getModuleNamespaceReplacement(); |
| 517 | 517 | $studlyName = $this->getStudlyNameReplacement(); |
| 518 | 518 | |
| 519 | - $provider = '"' . $namespace . '\\\\' . $studlyName . '\\\\Providers\\\\' . $studlyName . 'ServiceProvider"'; |
|
| 519 | + $provider = '"'.$namespace.'\\\\'.$studlyName.'\\\\Providers\\\\'.$studlyName.'ServiceProvider"'; |
|
| 520 | 520 | |
| 521 | 521 | $content = str_replace($provider, '', $content); |
| 522 | 522 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $lowerName = $this->getLowerName(); |
| 185 | 185 | |
| 186 | - $langPath = $this->getPath() . '/Resources/lang'; |
|
| 186 | + $langPath = $this->getPath().'/Resources/lang'; |
|
| 187 | 187 | |
| 188 | 188 | if (is_dir($langPath)) { |
| 189 | 189 | $this->loadTranslationsFrom($langPath, $lowerName); |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | $file = 'module.json'; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - return Arr::get($this->moduleJson, $file, function () use ($file) { |
|
| 207 | - return $this->moduleJson[$file] = new Json($this->getPath() . DIRECTORY_SEPARATOR . $file, $this->files); |
|
| 206 | + return Arr::get($this->moduleJson, $file, function() use ($file) { |
|
| 207 | + return $this->moduleJson[$file] = new Json($this->getPath().DIRECTORY_SEPARATOR.$file, $this->files); |
|
| 208 | 208 | }); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected function fireEvent($event): void |
| 259 | 259 | { |
| 260 | - $this->app['events']->dispatch(sprintf('modules.%s.' . $event, $this->getLowerName()), [$this]); |
|
| 260 | + $this->app['events']->dispatch(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]); |
|
| 261 | 261 | } |
| 262 | 262 | /** |
| 263 | 263 | * Register the aliases from this module. |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | protected function registerFiles(): void |
| 283 | 283 | { |
| 284 | 284 | foreach ($this->get('files', []) as $file) { |
| 285 | - include $this->path . DIRECTORY_SEPARATOR . $file; |
|
| 285 | + include $this->path.DIRECTORY_SEPARATOR.$file; |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public function getExtraPath(string $path): string |
| 389 | 389 | { |
| 390 | - return $this->getPath() . DIRECTORY_SEPARATOR . $path; |
|
| 390 | + return $this->getPath().DIRECTORY_SEPARATOR.$path; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->registerMigrations(); |
| 23 | 23 | |
| 24 | 24 | $this->publishes([ |
| 25 | - __DIR__ . '/../../database/migrations' => database_path('migrations'), |
|
| 25 | + __DIR__.'/../../database/migrations' => database_path('migrations'), |
|
| 26 | 26 | ], 'module-migrations'); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | private function registerMigrations() |
| 39 | 39 | { |
| 40 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
| 40 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $module = $this->find($name); |
| 90 | 90 | |
| 91 | 91 | if ($module) { |
| 92 | - return $module->getPath() . DIRECTORY_SEPARATOR; |
|
| 92 | + return $module->getPath().DIRECTORY_SEPARATOR; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - return $this->getPath() . DIRECTORY_SEPARATOR . Str::studly($name) . DIRECTORY_SEPARATOR; |
|
| 95 | + return $this->getPath().DIRECTORY_SEPARATOR.Str::studly($name).DIRECTORY_SEPARATOR; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function getCached() |
| 151 | 151 | { |
| 152 | 152 | return $this->cache->store($this->config->get('modules.cache.driver')) |
| 153 | - ->remember($this->config('cache.key'), $this->config('cache.lifetime'), function () { |
|
| 153 | + ->remember($this->config('cache.key'), $this->config('cache.lifetime'), function() { |
|
| 154 | 154 | return $this->getModel()->all()->keyBy('name')->toArray(); |
| 155 | 155 | }); |
| 156 | 156 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | // Support modules that already there or copy/paste and not scan yet. |
| 231 | 231 | // So we scan all module.json in every folder. |
| 232 | 232 | foreach ($paths as $path) { |
| 233 | - $manifests = $this->getFiles()->glob($path . DIRECTORY_SEPARATOR . 'module.json'); |
|
| 233 | + $manifests = $this->getFiles()->glob($path.DIRECTORY_SEPARATOR.'module.json'); |
|
| 234 | 234 | |
| 235 | 235 | is_array($manifests) || $manifests = []; |
| 236 | 236 | |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | public function update($name) |
| 273 | 273 | { |
| 274 | - $module = $this->findOrFail($name); |
|
| 274 | + $module = $this->findOrFail($name); |
|
| 275 | 275 | $updater = new Updater($this); |
| 276 | 276 | if ($this->config('database_management.update_file_to_database_when_updating')) { |
| 277 | - $json = Json::make($module->getPath() . DIRECTORY_SEPARATOR . 'module.json'); |
|
| 277 | + $json = Json::make($module->getPath().DIRECTORY_SEPARATOR.'module.json'); |
|
| 278 | 278 | $data = $json->getAttributes(); |
| 279 | 279 | |
| 280 | 280 | if (!isset($data['version'])) { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $allows = $this->getModel()->getFillable(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - return array_filter($attributes, function ($k) use ($allows) { |
|
| 310 | + return array_filter($attributes, function($k) use ($allows) { |
|
| 311 | 311 | return in_array($k, $allows); |
| 312 | 312 | }, ARRAY_FILTER_USE_KEY); |
| 313 | 313 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $modules = $this->allEnabled(); |
| 318 | 318 | |
| 319 | - uasort($modules, function (DatabaseModule $a, DatabaseModule $b) use ($direction) { |
|
| 319 | + uasort($modules, function(DatabaseModule $a, DatabaseModule $b) use ($direction) { |
|
| 320 | 320 | if ($a->get('priority') === $b->get('priority')) { |
| 321 | 321 | return 0; |
| 322 | 322 | } |