@@ -13,34 +13,34 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class AppServiceProvider extends ServiceProvider |
15 | 15 | { |
16 | - /** |
|
17 | - * Indicates if loading of the provider is deferred. |
|
18 | - * |
|
19 | - * @var bool |
|
20 | - */ |
|
21 | - protected $defer = false; |
|
16 | + /** |
|
17 | + * Indicates if loading of the provider is deferred. |
|
18 | + * |
|
19 | + * @var bool |
|
20 | + */ |
|
21 | + protected $defer = false; |
|
22 | 22 | |
23 | - public function boot() |
|
24 | - { |
|
23 | + public function boot() |
|
24 | + { |
|
25 | 25 | // For compatibility |
26 | 26 | Schema::defaultStringLength(191); |
27 | 27 | |
28 | 28 | // Config |
29 | 29 | $this->publishes([ |
30 | - __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
30 | + __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
31 | 31 | ], 'config'); |
32 | 32 | |
33 | 33 | // Views |
34 | 34 | $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'uccello'); |
35 | 35 | $this->publishes([ |
36 | - __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
36 | + __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
37 | 37 | ], 'views'); |
38 | 38 | |
39 | 39 | // Publish assets |
40 | 40 | $this->publishes([ |
41 | - __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
42 | - __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
43 | - __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
41 | + __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
42 | + __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
43 | + __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
44 | 44 | ], 'assets'); |
45 | 45 | |
46 | 46 | // Translations |
@@ -51,37 +51,37 @@ discard block |
||
51 | 51 | |
52 | 52 | // Commands |
53 | 53 | if ($this->app->runningInConsole()) { |
54 | - $this->commands([ |
|
54 | + $this->commands([ |
|
55 | 55 | UccelloInstallCommand::class, |
56 | - ]); |
|
56 | + ]); |
|
57 | + } |
|
57 | 58 | } |
58 | - } |
|
59 | 59 | |
60 | - public function register() |
|
61 | - { |
|
60 | + public function register() |
|
61 | + { |
|
62 | 62 | // Config |
63 | 63 | $this->mergeConfigFrom( |
64 | - __DIR__ . '/../../config/uccello.php', |
|
65 | - 'uccello' |
|
64 | + __DIR__ . '/../../config/uccello.php', |
|
65 | + 'uccello' |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | // Helper |
69 | 69 | App::bind('uccello', function () { |
70 | - return new \Uccello\Core\Helpers\Uccello; |
|
70 | + return new \Uccello\Core\Helpers\Uccello; |
|
71 | 71 | }); |
72 | 72 | |
73 | 73 | // Factories |
74 | 74 | $this->registerEloquentFactoriesFrom(__DIR__.'/../../database/factories'); |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Register factories. |
|
79 | - * |
|
80 | - * @param string $path |
|
81 | - * @return void |
|
82 | - */ |
|
83 | - protected function registerEloquentFactoriesFrom($path) |
|
84 | - { |
|
85 | - $this->app->make(EloquentFactory::class)->load($path); |
|
86 | - } |
|
77 | + /** |
|
78 | + * Register factories. |
|
79 | + * |
|
80 | + * @param string $path |
|
81 | + * @return void |
|
82 | + */ |
|
83 | + protected function registerEloquentFactoriesFrom($path) |
|
84 | + { |
|
85 | + $this->app->make(EloquentFactory::class)->load($path); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | \ No newline at end of file |
@@ -27,27 +27,27 @@ discard block |
||
27 | 27 | |
28 | 28 | // Config |
29 | 29 | $this->publishes([ |
30 | - __DIR__ . '/../../config/uccello.php' => config_path('uccello.php'), |
|
30 | + __DIR__.'/../../config/uccello.php' => config_path('uccello.php'), |
|
31 | 31 | ], 'config'); |
32 | 32 | |
33 | 33 | // Views |
34 | - $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'uccello'); |
|
34 | + $this->loadViewsFrom(__DIR__.'/../../resources/views', 'uccello'); |
|
35 | 35 | $this->publishes([ |
36 | - __DIR__ . '/../../resources/views' => resource_path('views/vendor/uccello') |
|
36 | + __DIR__.'/../../resources/views' => resource_path('views/vendor/uccello') |
|
37 | 37 | ], 'views'); |
38 | 38 | |
39 | 39 | // Publish assets |
40 | 40 | $this->publishes([ |
41 | - __DIR__ . '/../../public' => public_path('vendor/uccello/uccello'), |
|
42 | - __DIR__ . '/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
43 | - __DIR__ . '/../../public/images/vendor' => public_path('images/vendor') |
|
41 | + __DIR__.'/../../public' => public_path('vendor/uccello/uccello'), |
|
42 | + __DIR__.'/../../public/fonts/vendor' => public_path('fonts/vendor'), |
|
43 | + __DIR__.'/../../public/images/vendor' => public_path('images/vendor') |
|
44 | 44 | ], 'assets'); |
45 | 45 | |
46 | 46 | // Translations |
47 | - $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'uccello'); |
|
47 | + $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'uccello'); |
|
48 | 48 | |
49 | 49 | // Migrations |
50 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations'); |
|
50 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); |
|
51 | 51 | |
52 | 52 | // Commands |
53 | 53 | if ($this->app->runningInConsole()) { |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | { |
62 | 62 | // Config |
63 | 63 | $this->mergeConfigFrom( |
64 | - __DIR__ . '/../../config/uccello.php', |
|
64 | + __DIR__.'/../../config/uccello.php', |
|
65 | 65 | 'uccello' |
66 | 66 | ); |
67 | 67 | |
68 | 68 | // Helper |
69 | - App::bind('uccello', function () { |
|
69 | + App::bind('uccello', function() { |
|
70 | 70 | return new \Uccello\Core\Helpers\Uccello; |
71 | 71 | }); |
72 | 72 |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | // Pre-process |
39 | 39 | $this->preProcess($domain, $module, $request); |
40 | 40 | |
41 | - $mainModules = []; |
|
42 | - $adminModules = []; |
|
41 | + $mainModules = [ ]; |
|
42 | + $adminModules = [ ]; |
|
43 | 43 | foreach (Module::orderBy('id')->get() as $_module) { |
44 | 44 | if ($_module->isAdminModule()) { |
45 | - $adminModules[] = $_module; |
|
45 | + $adminModules[ ] = $_module; |
|
46 | 46 | } else { |
47 | - $mainModules[] = $_module; |
|
47 | + $mainModules[ ] = $_module; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | // Add message if defined |
103 | 103 | if (!empty($message)) { |
104 | - $result['message'] = uctrans($message, $module); |
|
104 | + $result[ 'message' ] = uctrans($message, $module); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Add error if defined |
108 | 108 | if (!empty($error)) { |
109 | - $result['error'] = uctrans($error, $module); |
|
109 | + $result[ 'error' ] = uctrans($error, $module); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $result; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @see Uccello\Core\Helpers\Uccello |
28 | 28 | */ |
29 | - function uctrans($key = null, ? Module $module = null, $replace = [], $locale = null) |
|
29 | + function uctrans($key = null, ? Module $module = null, $replace = [ ], $locale = null) |
|
30 | 30 | { |
31 | 31 | return app('uccello')->trans($key, $module, $replace, $locale); |
32 | 32 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param boolean $absolute |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - function ucroute($name, $domain = null, $module = null, $parameters = [], $absolute = true) : string |
|
59 | + function ucroute($name, $domain = null, $module = null, $parameters = [ ], $absolute = true) : string |
|
60 | 60 | { |
61 | 61 | return app('uccello')->route($name, $domain, $module, $parameters, $absolute); |
62 | 62 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string $package |
123 | 123 | * @return void |
124 | 124 | */ |
125 | - function ucasset($path, $package='uccello/uccello') |
|
125 | + function ucasset($path, $package = 'uccello/uccello') |
|
126 | 126 | { |
127 | 127 | return asset("vendor/$package/$path"); |
128 | 128 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $locale |
43 | 43 | * @return \Illuminate\Contracts\Translation\Translator|string|array|null |
44 | 44 | */ |
45 | - public function trans($key = null, ?Module $module = null, $replace = [], $locale = null) |
|
45 | + public function trans($key = null, ?Module $module = null, $replace = [ ], $locale = null) |
|
46 | 46 | { |
47 | 47 | $translator = app('translator'); |
48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // 2. Get translation in package |
67 | 67 | if (!empty($module->package)) { |
68 | 68 | // If a package name is defined add it before |
69 | - $prefix = $module->package . '::'. $prefix; |
|
69 | + $prefix = $module->package.'::'.$prefix; |
|
70 | 70 | |
71 | 71 | $translation = $translator->trans($prefix.$key, $replace, $locale); |
72 | 72 | if ($translation !== $prefix.$key) { |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | public function view(string $package, Module $module, string $viewName, ?string $fallbackView = null): ?string |
116 | 116 | { |
117 | 117 | // Module view overrided in app |
118 | - $appModuleView = 'modules.' . $module->name . '.' . $viewName; |
|
118 | + $appModuleView = 'modules.'.$module->name.'.'.$viewName; |
|
119 | 119 | |
120 | 120 | // Default view overrided in app |
121 | - $appDefaultView = 'modules.default.' . $viewName; |
|
121 | + $appDefaultView = 'modules.default.'.$viewName; |
|
122 | 122 | |
123 | 123 | // Module view ovverrided in package |
124 | - $packageModuleView = $package . '::modules.' . $module->name . '.' . $viewName; |
|
124 | + $packageModuleView = $package.'::modules.'.$module->name.'.'.$viewName; |
|
125 | 125 | |
126 | 126 | // Default view defined in package |
127 | - $packageDefaultView = $package . '::modules.default.' . $viewName; |
|
127 | + $packageDefaultView = $package.'::modules.default.'.$viewName; |
|
128 | 128 | |
129 | 129 | // Module view ovverrided in uccello |
130 | - $uccelloModuleView = 'uccello::modules.' . $module->name . '.' . $viewName; |
|
130 | + $uccelloModuleView = 'uccello::modules.'.$module->name.'.'.$viewName; |
|
131 | 131 | |
132 | 132 | // Default view defined in uccello |
133 | - $uccelloDefaultView = 'uccello::modules.default.' . $viewName; |
|
133 | + $uccelloDefaultView = 'uccello::modules.default.'.$viewName; |
|
134 | 134 | |
135 | 135 | $viewToInclude = null; |
136 | 136 | if (view()->exists($appModuleView)) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param boolean $absolute |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - public function route($name, $domain = null, $module = null, $parameters = [], $absolute = true) : string |
|
165 | + public function route($name, $domain = null, $module = null, $parameters = [ ], $absolute = true) : string |
|
166 | 166 | { |
167 | 167 | if (is_a($domain, Domain::class)) { |
168 | 168 | $domain = $domain->slug; |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | |
178 | 178 | // Add domain to route if we use multi domains and if the parameter is needed |
179 | 179 | if (!is_null($domain) && uccello()->useMultiDomains() && preg_match('`{domain}`', $routeUri)) { |
180 | - $parameters['domain'] = $domain; |
|
180 | + $parameters[ 'domain' ] = $domain; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Add module to route if the parameter is needed |
184 | 184 | if (!is_null($module) && preg_match('`{module}`', $routeUri)) { |
185 | - $parameters['module'] = $module; |
|
185 | + $parameters[ 'module' ] = $module; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return route($name, $parameters, $absolute); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if (is_numeric($nameOrId)) { |
212 | 212 | return Module::find($nameOrId); |
213 | 213 | } else { |
214 | - return Module::where('name', (string) $nameOrId)->first(); |
|
214 | + return Module::where('name', (string)$nameOrId)->first(); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if (is_numeric($nameOrId)) { |
227 | 227 | return Uitype::find($nameOrId); |
228 | 228 | } else { |
229 | - return Uitype::where('name', (string) $nameOrId)->first(); |
|
229 | + return Uitype::where('name', (string)$nameOrId)->first(); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | if (is_numeric($nameOrId)) { |
242 | 242 | return Displaytype::find($nameOrId); |
243 | 243 | } else { |
244 | - return Displaytype::where('name', (string) $nameOrId)->first(); |
|
244 | + return Displaytype::where('name', (string)$nameOrId)->first(); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | if (is_numeric($nameOrId)) { |
257 | 257 | return Capability::find($nameOrId); |
258 | 258 | } else { |
259 | - return Capability::where('name', (string) $nameOrId)->first(); |
|
259 | + return Capability::where('name', (string)$nameOrId)->first(); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $domain = Auth::user()->lastDomain ?? null; // On login page user is not authenticated |
281 | 281 | |
282 | 282 | if (!$domain) { |
283 | - $domain = $this->getRootDomains()[0]; |
|
283 | + $domain = $this->getRootDomains()[ 0 ]; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $domain; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function getDatatableColumns(Module $module): array |
296 | 296 | { |
297 | - $columns = []; |
|
297 | + $columns = [ ]; |
|
298 | 298 | |
299 | 299 | // Get default filter |
300 | 300 | $filter = Filter::where('module_id', $module->id) |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | |
307 | 307 | foreach ($fields as $field) { |
308 | 308 | // If the field is not listable, continue |
309 | - if (!$field->isListable()){ |
|
309 | + if (!$field->isListable()) { |
|
310 | 310 | continue; |
311 | 311 | } |
312 | 312 | |
313 | 313 | // Add the field as a new column |
314 | - $columns[] = [ |
|
314 | + $columns[ ] = [ |
|
315 | 315 | 'name' => $field->name, |
316 | 316 | 'db_column' => $field->column, |
317 | 317 | 'uitype' => $field->uitype->name, |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // Get the menu to display according to the environment (main or admin) |
81 | 81 | $domainMenu = $this->getDomainMenuToDisplay(); |
82 | 82 | |
83 | - $this->menuAddedModules = []; |
|
83 | + $this->menuAddedModules = [ ]; |
|
84 | 84 | |
85 | 85 | // If a menu was created, use it |
86 | 86 | if (!is_null($domainMenu)) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | if (!empty($menuLink->module)) { |
199 | 199 | if (!in_array($menuLink->module, $this->menuAddedModules)) { |
200 | - $this->menuAddedModules[] = $menuLink->module; |
|
200 | + $this->menuAddedModules[ ] = $menuLink->module; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | |
247 | 247 | // Link html |
248 | 248 | $link = Html::raw( |
249 | - '<a href="'. $url .'" class="'. $class .'">'. |
|
249 | + '<a href="'.$url.'" class="'.$class.'">'. |
|
250 | 250 | // (!$isInSubMenu ? '<i class="material-icons">'. $icon .'</i>' : ''). |
251 | 251 | // (!$isInSubMenu ? '<span>'. $label .'</span>' : $label). |
252 | - '<i class="material-icons">'. $icon .'</i>'. |
|
253 | - '<span>'. $label .'</span>'. |
|
252 | + '<i class="material-icons">'.$icon.'</i>'. |
|
253 | + '<span>'.$label.'</span>'. |
|
254 | 254 | '</a>' |
255 | 255 | )->setActive($isActive); |
256 | 256 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -$factory->define(\Uccello\Core\Models\User::class, function (Faker $faker) { |
|
16 | +$factory->define(\Uccello\Core\Models\User::class, function(Faker $faker) { |
|
17 | 17 | return [ |
18 | 18 | 'username' => $faker->name, |
19 | 19 | 'first_name' => $faker->firstName, |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -$factory->define(\Uccello\Core\Models\Module::class, function (Faker $faker) { |
|
16 | +$factory->define(\Uccello\Core\Models\Module::class, function(Faker $faker) { |
|
17 | 17 | |
18 | 18 | return [ |
19 | 19 | 'name' => $faker->name, |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -$factory->define(\Uccello\Core\Models\Domain::class, function (Faker $faker) { |
|
16 | +$factory->define(\Uccello\Core\Models\Domain::class, function(Faker $faker) { |
|
17 | 17 | $name = $faker->company; |
18 | 18 | |
19 | 19 | return [ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ]); |
32 | 32 | |
33 | 33 | // Test response content |
34 | - $response->assertJson(['success' => true, 'message' => uctrans('message.module_deactivated', ucmodule('settings'))]); |
|
34 | + $response->assertJson([ 'success' => true, 'message' => uctrans('message.module_deactivated', ucmodule('settings')) ]); |
|
35 | 35 | |
36 | 36 | // Activation status wash changed |
37 | 37 | $module = $module->refresh(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | ]); |
46 | 46 | |
47 | 47 | // Test response content |
48 | - $response->assertJson(['success' => true, 'message' => uctrans('message.module_activated', ucmodule('settings'))]); |
|
48 | + $response->assertJson([ 'success' => true, 'message' => uctrans('message.module_activated', ucmodule('settings')) ]); |
|
49 | 49 | |
50 | 50 | // Test if activation status was changed |
51 | 51 | $module = $module->refresh(); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ]); |
74 | 74 | |
75 | 75 | // Test response content |
76 | - $response->assertJson(['success' => false, 'error' => uctrans('error.module_is_mandatory', ucmodule('settings'))]); |
|
76 | + $response->assertJson([ 'success' => false, 'error' => uctrans('error.module_is_mandatory', ucmodule('settings')) ]); |
|
77 | 77 | |
78 | 78 | // Test if activation status was not changed |
79 | 79 | $module = $module->refresh(); |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | ]); |
96 | 96 | |
97 | 97 | // Test response content |
98 | - $response->assertJson(['success' => false, 'error' => uctrans('error.module_not_defined', ucmodule('settings'))]); |
|
98 | + $response->assertJson([ 'success' => false, 'error' => uctrans('error.module_not_defined', ucmodule('settings')) ]); |
|
99 | 99 | } |
100 | 100 | } |