@@ -13,9 +13,9 @@ |
||
13 | 13 | |
14 | 14 | use Modules\Authorization\Entities\Permission; |
15 | 15 | |
16 | -Route::get('/{id}', 'MachineController@show')->middleware(['permission:'.Permission::SHOW_MACHINE]); |
|
17 | -Route::patch('/{id}', 'MachineController@update')->middleware(['permission:'.Permission::UPDATE_MACHINE]); |
|
18 | -Route::delete('/{id}', 'MachineController@destroy')->middleware(['permission:'.Permission::DELETE_MACHINE]); |
|
16 | +Route::get('/{id}', 'MachineController@show')->middleware([ 'permission:'.Permission::SHOW_MACHINE ]); |
|
17 | +Route::patch('/{id}', 'MachineController@update')->middleware([ 'permission:'.Permission::UPDATE_MACHINE ]); |
|
18 | +Route::delete('/{id}', 'MachineController@destroy')->middleware([ 'permission:'.Permission::DELETE_MACHINE ]); |
|
19 | 19 | |
20 | -Route::post('/', 'MachineController@store')->middleware(['permission:'.Permission::CREATE_MACHINE]); |
|
21 | -Route::get('/', 'MachineController@index')->middleware(['permission:'.Permission::SHOW_MACHINE]); |
|
20 | +Route::post('/', 'MachineController@store')->middleware([ 'permission:'.Permission::CREATE_MACHINE ]); |
|
21 | +Route::get('/', 'MachineController@index')->middleware([ 'permission:'.Permission::SHOW_MACHINE ]); |
@@ -13,9 +13,9 @@ |
||
13 | 13 | |
14 | 14 | use Modules\Authorization\Entities\Permission; |
15 | 15 | |
16 | -Route::get('/{id}', 'AccountController@show')->middleware(['permission:'.Permission::SHOW_ACCOUNT]); |
|
17 | -Route::patch('/{id}', 'AccountController@update')->middleware(['permission:'.Permission::UPDATE_ACCOUNT]); |
|
18 | -Route::delete('/{id}', 'AccountController@destroy')->middleware(['permission:'.Permission::DELETE_ACCOUNT]); |
|
16 | +Route::get('/{id}', 'AccountController@show')->middleware([ 'permission:'.Permission::SHOW_ACCOUNT ]); |
|
17 | +Route::patch('/{id}', 'AccountController@update')->middleware([ 'permission:'.Permission::UPDATE_ACCOUNT ]); |
|
18 | +Route::delete('/{id}', 'AccountController@destroy')->middleware([ 'permission:'.Permission::DELETE_ACCOUNT ]); |
|
19 | 19 | |
20 | -Route::post('/', 'AccountController@store')->middleware(['permission:'.Permission::CREATE_ACCOUNT]); |
|
21 | -Route::get('/', 'AccountController@index')->middleware(['permission:'.Permission::INDEX_ACCOUNT]); |
|
20 | +Route::post('/', 'AccountController@store')->middleware([ 'permission:'.Permission::CREATE_ACCOUNT ]); |
|
21 | +Route::get('/', 'AccountController@index')->middleware([ 'permission:'.Permission::INDEX_ACCOUNT ]); |
@@ -14,5 +14,5 @@ |
||
14 | 14 | use Modules\Authorization\Entities\Permission; |
15 | 15 | |
16 | 16 | Route::get('/me', 'UserController@show'); |
17 | -Route::patch('/{id}', 'UserController@update')->middleware(['permission:'.Permission::ASSIGN_ROLES]); |
|
18 | -Route::get('/', 'UserController@index')->middleware(['permission:'.Permission::INDEX_USERS]); |
|
17 | +Route::patch('/{id}', 'UserController@update')->middleware([ 'permission:'.Permission::ASSIGN_ROLES ]); |
|
18 | +Route::get('/', 'UserController@index')->middleware([ 'permission:'.Permission::INDEX_USERS ]); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'cpu_usage' => rand(0, 100), |
54 | 54 | 'memory_usage' => rand(1, $machine->memory_available), |
55 | 55 | ]); |
56 | - $this->machineService->update($machine, ['online' => (bool) rand(0, 1)]); |
|
56 | + $this->machineService->update($machine, [ 'online' => (bool) rand(0, 1) ]); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'cpu_usage' => rand(0, 100), |
65 | 65 | 'memory_usage' => rand(1, $account->memory_available), |
66 | 66 | ]); |
67 | - $this->accountService->update($account, ['online' => (bool) rand(0, 1)]); |
|
67 | + $this->accountService->update($account, [ 'online' => (bool) rand(0, 1) ]); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function buildEmptyBootstrapArray() |
90 | 90 | { |
91 | - $bootstrapArray = []; |
|
91 | + $bootstrapArray = [ ]; |
|
92 | 92 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
93 | - $bootstrapArray[$key] = []; |
|
93 | + $bootstrapArray[ $key ] = [ ]; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | return $bootstrapArray; |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | private function getModules(): array |
103 | 103 | { |
104 | 104 | $path = base_path('src/Modules'); |
105 | - $moduleNames = array_diff(scandir($path), ['..', '.']); |
|
106 | - $modules = []; |
|
105 | + $moduleNames = array_diff(scandir($path), [ '..', '.' ]); |
|
106 | + $modules = [ ]; |
|
107 | 107 | foreach ($moduleNames as $moduleName) { |
108 | - $modules[$moduleName] = $path.'/'.$moduleName; |
|
108 | + $modules[ $moduleName ] = $path.'/'.$moduleName; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return $modules; |
@@ -135,38 +135,38 @@ discard block |
||
135 | 135 | try { |
136 | 136 | $command = new $class(); |
137 | 137 | if ($command instanceof Command) { |
138 | - $bootstrap[$key][] = $class; |
|
138 | + $bootstrap[ $key ][ ] = $class; |
|
139 | 139 | } |
140 | 140 | } catch (\Exception $e) { |
141 | 141 | break; |
142 | 142 | } |
143 | 143 | break; |
144 | 144 | case 'routes': |
145 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace, $fileName); |
|
145 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace, $fileName); |
|
146 | 146 | break; |
147 | 147 | case 'configs': |
148 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
148 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
149 | 149 | break; |
150 | 150 | case 'factories': |
151 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
151 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
152 | 152 | break; |
153 | 153 | case 'migrations': |
154 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
154 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
155 | 155 | break; |
156 | 156 | case 'seeders': |
157 | - $bootstrap[$key][] = $class; |
|
157 | + $bootstrap[ $key ][ ] = $class; |
|
158 | 158 | break; |
159 | 159 | case 'models': |
160 | - $bootstrap[$key][] = $class; |
|
160 | + $bootstrap[ $key ][ ] = $class; |
|
161 | 161 | break; |
162 | 162 | case 'policies': |
163 | - $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace); |
|
163 | + $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace); |
|
164 | 164 | break; |
165 | 165 | case 'providers': |
166 | - $bootstrap[$key][] = $class; |
|
166 | + $bootstrap[ $key ][ ] = $class; |
|
167 | 167 | break; |
168 | 168 | case 'events': |
169 | - $bootstrap[$key][] = $this->buildEventsArray($class); |
|
169 | + $bootstrap[ $key ][ ] = $this->buildEventsArray($class); |
|
170 | 170 | break; |
171 | 171 | default: |
172 | 172 | break; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | private function hasPhpExtension(string $fileName): bool |
190 | 190 | { |
191 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]); |
|
191 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $apiDomain = str_replace('http://', '', $apiDomain); |
220 | 220 | $apiDomain = str_replace('https://', '', $apiDomain); |
221 | 221 | $moduleNamespace = $namespace; |
222 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
222 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
223 | 223 | $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers'; |
224 | 224 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
225 | 225 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | private function buildPolicyArray($class, $namespace) |
244 | 244 | { |
245 | 245 | $moduleNamespace = $namespace; |
246 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
246 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
247 | 247 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
248 | 248 | |
249 | 249 | return [ |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | |
282 | 282 | private function buildEventsArray($class) |
283 | 283 | { |
284 | - $listenerProperties = get_class_property($class, 'listeners') ?? []; |
|
285 | - $listeners = []; |
|
284 | + $listenerProperties = get_class_property($class, 'listeners') ?? [ ]; |
|
285 | + $listeners = [ ]; |
|
286 | 286 | foreach ($listenerProperties as $listener) { |
287 | 287 | if (class_implements_interface($listener, ListenerContract::class)) { |
288 | - $listeners[] = $listener; |
|
288 | + $listeners[ ] = $listener; |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getCommands(): array |
302 | 302 | { |
303 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
303 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function getRoutes(): array |
310 | 310 | { |
311 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
311 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getConfigs(): array |
318 | 318 | { |
319 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
319 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function getFactories(): array |
326 | 326 | { |
327 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
327 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function getMigrations(): array |
334 | 334 | { |
335 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
335 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getSeeders(): array |
342 | 342 | { |
343 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
343 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | public function getModels(): array |
350 | 350 | { |
351 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
351 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function getPolicies(): array |
358 | 358 | { |
359 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
359 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function getProviders(): array |
366 | 366 | { |
367 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
367 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -372,6 +372,6 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function getEvents(): array |
374 | 374 | { |
375 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
375 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
376 | 376 | } |
377 | 377 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | private function loadRoutes() |
78 | 78 | { |
79 | 79 | foreach ($this->bootstrapService->getRoutes() as $route) { |
80 | - $path = $route['path']; |
|
81 | - $fileNameArray = explode('.', $route['filename']); |
|
82 | - $routePrefix = $fileNameArray[0]; |
|
83 | - $version = $fileNameArray[1]; |
|
80 | + $path = $route[ 'path' ]; |
|
81 | + $fileNameArray = explode('.', $route[ 'filename' ]); |
|
82 | + $routePrefix = $fileNameArray[ 0 ]; |
|
83 | + $version = $fileNameArray[ 1 ]; |
|
84 | 84 | |
85 | 85 | if ($version === 'php') { |
86 | 86 | $prefix = $routePrefix; |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | |
91 | 91 | Route::group([ |
92 | 92 | 'prefix' => $prefix, |
93 | - 'namespace' => $route['controller'], |
|
94 | - 'domain' => $route['domain'], |
|
95 | - 'middleware' => ['api'], |
|
96 | - ], function () use ($path) { |
|
93 | + 'namespace' => $route[ 'controller' ], |
|
94 | + 'domain' => $route[ 'domain' ], |
|
95 | + 'middleware' => [ 'api' ], |
|
96 | + ], function() use ($path) { |
|
97 | 97 | require $path; |
98 | 98 | }); |
99 | - Route::model($route['module'], $route['model']); |
|
99 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | protected function loadConfigs() |
109 | 109 | { |
110 | 110 | foreach ($this->bootstrapService->getConfigs() as $config) { |
111 | - if (isset($config['filename']) && is_string($config['filename'])) { |
|
112 | - $fileName = $config['filename']; |
|
113 | - $configName = strtolower(explode('.', $fileName)[0]); |
|
111 | + if (isset($config[ 'filename' ]) && is_string($config[ 'filename' ])) { |
|
112 | + $fileName = $config[ 'filename' ]; |
|
113 | + $configName = strtolower(explode('.', $fileName)[ 0 ]); |
|
114 | 114 | $this->mergeConfigFrom( |
115 | - $config['path'], $configName |
|
115 | + $config[ 'path' ], $configName |
|
116 | 116 | ); |
117 | 117 | } |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | foreach ($this->bootstrapService->getFactories() as $factory) { |
129 | 129 | if (!$this->app->environment('production')) { |
130 | - app(Factory::class)->load($factory['path']); |
|
130 | + app(Factory::class)->load($factory[ 'path' ]); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | public function loadMigrations() |
141 | 141 | { |
142 | 142 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
143 | - $this->loadMigrationsFrom($migration['path']); |
|
143 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | private function loadPolicies() |
148 | 148 | { |
149 | 149 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
150 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
151 | - Gate::policy($policy['model'], $policy['class']); |
|
150 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
151 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | { |
158 | 158 | $app = $this->app; |
159 | 159 | $service = $this->bootstrapService; |
160 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
161 | - return new SeedCommand($app['db'], $service); |
|
160 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
161 | + return new SeedCommand($app[ 'db' ], $service); |
|
162 | 162 | }); |
163 | 163 | } |
164 | 164 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | private function loadListeners() |
194 | 194 | { |
195 | 195 | foreach ($this->bootstrapService->getEvents() as $event) { |
196 | - foreach ($event['listeners'] as $listener) { |
|
197 | - Event::listen($event['class'], $listener); |
|
196 | + foreach ($event[ 'listeners' ] as $listener) { |
|
197 | + Event::listen($event[ 'class' ], $listener); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | class AccountUpdatedEvent extends Event implements ShouldBroadcast |
18 | 18 | { |
19 | - public $listeners = []; |
|
19 | + public $listeners = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var account |
@@ -33,7 +33,7 @@ |
||
33 | 33 | /** |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $guarded = []; |
|
36 | + protected $guarded = [ ]; |
|
37 | 37 | |
38 | 38 | protected $casts = [ |
39 | 39 | 'online' => 'boolean', |
@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | public function assignToMachine($id, ?Machine $machine) |
65 | 65 | { |
66 | - return $this->update($id, ['machine_id' => $machine->id ?? null]); |
|
66 | + return $this->update($id, [ 'machine_id' => $machine->id ?? null ]); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function unlinkFromMachine($id) |