@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getProviders(): array |
56 | 56 | { |
57 | - if (! empty($this->manifest)) { |
|
57 | + if (!empty($this->manifest)) { |
|
58 | 58 | return $this->manifest; |
59 | 59 | } |
60 | 60 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | // todo check this section store on module.php or not? |
79 | 79 | $this->getModulesData() |
80 | - ->each(function (array $manifest) { |
|
80 | + ->each(function(array $manifest) { |
|
81 | 81 | if (empty($manifest['files'])) { |
82 | 82 | return; |
83 | 83 | } |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | |
91 | 91 | public function getModulesData(): Collection |
92 | 92 | { |
93 | - if (! empty(self::$manifestData) && ! app()->runningUnitTests()) { |
|
93 | + if (!empty(self::$manifestData) && !app()->runningUnitTests()) { |
|
94 | 94 | return self::$manifestData; |
95 | 95 | } |
96 | 96 | |
97 | 97 | self::$manifestData = $this->paths |
98 | - ->flatMap(function ($path) { |
|
98 | + ->flatMap(function($path) { |
|
99 | 99 | $manifests = $this->files->glob("{$path}/module.json"); |
100 | 100 | is_array($manifests) || $manifests = []; |
101 | 101 | |
102 | 102 | return collect($manifests) |
103 | - ->map(function ($manifest) { |
|
103 | + ->map(function($manifest) { |
|
104 | 104 | return [ |
105 | 105 | 'module_directory' => dirname($manifest), |
106 | 106 | ...$this->files->json($manifest), |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use Illuminate\Support\Facades\Vite as ViteFacade; |
6 | 6 | use Nwidart\Modules\Laravel\Module; |
7 | 7 | |
8 | -if (! function_exists('module')) { |
|
8 | +if (!function_exists('module')) { |
|
9 | 9 | /** |
10 | 10 | * Retrieves a module status or its instance. |
11 | 11 | * |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | * @param bool $instance Whether to return the module's instance instead of the status. Defaults to false [status]. |
14 | 14 | * @return bool|Module The module instance or its status. |
15 | 15 | */ |
16 | - function module(string $name, bool $instance = false): bool|Module |
|
16 | + function module(string $name, bool $instance = false): bool | Module |
|
17 | 17 | { |
18 | 18 | $modules = app('modules'); |
19 | - if (! $modules->has($name)) { |
|
19 | + if (!$modules->has($name)) { |
|
20 | 20 | Log::error("Module '$name' not found."); |
21 | 21 | |
22 | 22 | return false; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -if (! function_exists('module_path')) { |
|
29 | +if (!function_exists('module_path')) { |
|
30 | 30 | function module_path(string $name, string $path = ''): string |
31 | 31 | { |
32 | 32 | $module = app('modules')->find($name); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -if (! function_exists('config_path')) { |
|
38 | +if (!function_exists('config_path')) { |
|
39 | 39 | /** |
40 | 40 | * Get the configuration path. |
41 | 41 | */ |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | -if (! function_exists('public_path')) { |
|
48 | +if (!function_exists('public_path')) { |
|
49 | 49 | /** |
50 | 50 | * Get the path to the public folder. |
51 | 51 | */ |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -if (! function_exists('module_vite')) { |
|
58 | +if (!function_exists('module_vite')) { |
|
59 | 59 | /** |
60 | 60 | * support for vite |
61 | 61 | */ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | ]); |
41 | 41 | |
42 | 42 | // Create @module() blade directive. |
43 | - Blade::if('module', function (string $name) { |
|
43 | + Blade::if ('module', function(string $name) { |
|
44 | 44 | return module($name); |
45 | 45 | }); |
46 | 46 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $path = $this->app['config']->get('modules.stubs.path') ?? __DIR__.'/Commands/stubs'; |
69 | 69 | Stub::setBasePath($path); |
70 | 70 | |
71 | - $this->app->booted(function ($app) { |
|
71 | + $this->app->booted(function($app) { |
|
72 | 72 | /** @var RepositoryInterface $moduleRepository */ |
73 | 73 | $moduleRepository = $app[RepositoryInterface::class]; |
74 | 74 | if ($moduleRepository->config('stubs.enabled') === true) { |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function registerServices() |
84 | 84 | { |
85 | - $this->app->singleton(Contracts\RepositoryInterface::class, function ($app) { |
|
85 | + $this->app->singleton(Contracts\RepositoryInterface::class, function($app) { |
|
86 | 86 | $path = $app['config']->get('modules.paths.modules'); |
87 | 87 | |
88 | 88 | return new Laravel\LaravelFileRepository($app, $path); |
89 | 89 | }); |
90 | - $this->app->singleton(Contracts\ActivatorInterface::class, function ($app) { |
|
90 | + $this->app->singleton(Contracts\ActivatorInterface::class, function($app) { |
|
91 | 91 | $activator = $app['config']->get('modules.activator'); |
92 | 92 | $class = $app['config']->get('modules.activators.'.$activator)['class']; |
93 | 93 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | |
103 | 103 | protected function registerMigrations(): void |
104 | 104 | { |
105 | - if (! $this->app['config']->get('modules.auto-discover.migrations', true)) { |
|
105 | + if (!$this->app['config']->get('modules.auto-discover.migrations', true)) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
109 | - $this->app->resolving(Migrator::class, function (Migrator $migrator) { |
|
109 | + $this->app->resolving(Migrator::class, function(Migrator $migrator) { |
|
110 | 110 | $migration_path = $this->app['config']->get('modules.paths.generator.migration.path'); |
111 | 111 | collect(\Nwidart\Modules\Facades\Module::allEnabled()) |
112 | - ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) { |
|
112 | + ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($migration_path, $migrator) { |
|
113 | 113 | $migrator->path($module->getExtraPath($migration_path)); |
114 | 114 | }); |
115 | 115 | }); |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | |
118 | 118 | protected function registerTranslations(): void |
119 | 119 | { |
120 | - if (! $this->app['config']->get('modules.auto-discover.translations', true)) { |
|
120 | + if (!$this->app['config']->get('modules.auto-discover.translations', true)) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | - $this->callAfterResolving('translator', function (TranslatorContract $translator) { |
|
124 | - if (! $translator instanceof Translator) { |
|
123 | + $this->callAfterResolving('translator', function(TranslatorContract $translator) { |
|
124 | + if (!$translator instanceof Translator) { |
|
125 | 125 | return; |
126 | 126 | } |
127 | 127 | |
128 | 128 | collect(\Nwidart\Modules\Facades\Module::allEnabled()) |
129 | - ->each(function (\Nwidart\Modules\Laravel\Module $module) use ($translator) { |
|
129 | + ->each(function(\Nwidart\Modules\Laravel\Module $module) use ($translator) { |
|
130 | 130 | $path = $module->getExtraPath($this->app['config']->get('modules.paths.generator.lang.path')); |
131 | 131 | $translator->addNamespace($module->getLowerName(), $path); |
132 | 132 | $translator->addJsonPath($path); |