@@ -13,11 +13,11 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | 'supportsCredentials' => false, |
16 | - 'allowedOrigins' => ['*'], |
|
17 | - 'allowedOriginsPatterns' => [], |
|
18 | - 'allowedHeaders' => ['*'], |
|
19 | - 'allowedMethods' => ['*'], |
|
20 | - 'exposedHeaders' => [], |
|
16 | + 'allowedOrigins' => [ '*' ], |
|
17 | + 'allowedOriginsPatterns' => [ ], |
|
18 | + 'allowedHeaders' => [ '*' ], |
|
19 | + 'allowedMethods' => [ '*' ], |
|
20 | + 'exposedHeaders' => [ ], |
|
21 | 21 | 'maxAge' => 0, |
22 | 22 | |
23 | 23 | ]; |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | private function loadRoutes() |
64 | 64 | { |
65 | 65 | foreach ($this->bootstrapService->getRoutes() as $route) { |
66 | - $path = $route['path']; |
|
66 | + $path = $route[ 'path' ]; |
|
67 | 67 | Route::group([ |
68 | - 'prefix' => 'v1/'.$route['module'], |
|
69 | - 'namespace' => $route['controller'], |
|
70 | - 'domain' => $route['domain'], |
|
71 | - 'middleware' => ['api'], |
|
72 | - ], function () use ($path) { |
|
68 | + 'prefix' => 'v1/'.$route[ 'module' ], |
|
69 | + 'namespace' => $route[ 'controller' ], |
|
70 | + 'domain' => $route[ 'domain' ], |
|
71 | + 'middleware' => [ 'api' ], |
|
72 | + ], function() use ($path) { |
|
73 | 73 | require $path; |
74 | 74 | }); |
75 | - Route::model($route['module'], $route['model']); |
|
75 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | { |
86 | 86 | foreach ($this->bootstrapService->getConfigs() as $config) { |
87 | 87 | $this->publishes([ |
88 | - $config['path'] => config_path($config['module']), |
|
88 | + $config[ 'path' ] => config_path($config[ 'module' ]), |
|
89 | 89 | ], 'config'); |
90 | 90 | $this->mergeConfigFrom( |
91 | - $config['path'], basename($config['module'], '.php') |
|
91 | + $config[ 'path' ], basename($config[ 'module' ], '.php') |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | { |
103 | 103 | foreach ($this->bootstrapService->getFactories() as $factory) { |
104 | 104 | if (!$this->app->environment('production')) { |
105 | - app(Factory::class)->load($factory['path']); |
|
105 | + app(Factory::class)->load($factory[ 'path' ]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | public function loadMigrations() |
116 | 116 | { |
117 | 117 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
118 | - $this->loadMigrationsFrom($migration['path']); |
|
118 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | private function loadPolicies() |
123 | 123 | { |
124 | 124 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
125 | - if (classImplementsInterface($policy['class'], ModelPolicyContract::class)) { |
|
126 | - Gate::policy($policy['model'], $policy['class']); |
|
125 | + if (classImplementsInterface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
126 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | { |
133 | 133 | $app = $this->app; |
134 | 134 | $service = $this->bootstrapService; |
135 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
136 | - return new SeedCommand($app['db'], $service); |
|
135 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
136 | + return new SeedCommand($app[ 'db' ], $service); |
|
137 | 137 | }); |
138 | 138 | } |
139 | 139 |
@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('App.User.{id}', function ($user, $id) { |
|
14 | +Broadcast::channel('App.User.{id}', function($user, $id) { |
|
15 | 15 | return (int) $user->id === (int) $id; |
16 | 16 | }); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { |
|
4 | - $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; |
|
3 | +if (isset($_SERVER[ 'HTTP_CF_CONNECTING_IP' ])) { |
|
4 | + $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ 'HTTP_CF_CONNECTING_IP' ]; |
|
5 | 5 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | $randomIndex = random_int(0, count($array) - 1); |
44 | 44 | |
45 | - return $array[$randomIndex]; |
|
45 | + return $array[ $randomIndex ]; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | if (!function_exists('createArrayFromFactory')) { |
@@ -91,6 +91,6 @@ discard block |
||
91 | 91 | |
92 | 92 | $traits = array_flip(class_uses_recursive($class)); |
93 | 93 | |
94 | - return isset($traits[$trait]); |
|
94 | + return isset($traits[ $trait ]); |
|
95 | 95 | } |
96 | 96 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public static function find($id, $modelClass) |
24 | 24 | { |
25 | - return Cache::remember(self::getCacheName($id, $modelClass), self::getCacheTime(), function () use ($id, $modelClass) { |
|
25 | + return Cache::remember(self::getCacheName($id, $modelClass), self::getCacheTime(), function() use ($id, $modelClass) { |
|
26 | 26 | return $modelClass::find($id); |
27 | 27 | }); |
28 | 28 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function buildEmptyBootstrapArray() |
100 | 100 | { |
101 | - $bootstrapArray = []; |
|
101 | + $bootstrapArray = [ ]; |
|
102 | 102 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
103 | - $bootstrapArray[$key] = []; |
|
103 | + $bootstrapArray[ $key ] = [ ]; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return $bootstrapArray; |
@@ -136,32 +136,32 @@ discard block |
||
136 | 136 | try { |
137 | 137 | $command = new $class(); |
138 | 138 | if ($command instanceof Command) { |
139 | - $bootstrap[$key][] = $class; |
|
139 | + $bootstrap[ $key ][ ] = $class; |
|
140 | 140 | } |
141 | 141 | } catch (\Exception $e) { |
142 | 142 | break; |
143 | 143 | } |
144 | 144 | break; |
145 | 145 | case 'routes': |
146 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace); |
|
146 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace); |
|
147 | 147 | break; |
148 | 148 | case 'configs': |
149 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath.'/'.$fileName, $module->getName()); |
|
149 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $module->getName()); |
|
150 | 150 | break; |
151 | 151 | case 'factories': |
152 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
152 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
153 | 153 | break; |
154 | 154 | case 'migrations': |
155 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
155 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
156 | 156 | break; |
157 | 157 | case 'seeders': |
158 | - $bootstrap[$key][] = $class; |
|
158 | + $bootstrap[ $key ][ ] = $class; |
|
159 | 159 | break; |
160 | 160 | case 'models': |
161 | - $bootstrap[$key][] = $class; |
|
161 | + $bootstrap[ $key ][ ] = $class; |
|
162 | 162 | break; |
163 | 163 | case 'policies': |
164 | - $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace); |
|
164 | + $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace); |
|
165 | 165 | break; |
166 | 166 | default: |
167 | 167 | break; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function hasPhpExtension(string $fileName): bool |
184 | 184 | { |
185 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]); |
|
185 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $apiDomain = str_replace('http://', '', $apiDomain); |
214 | 214 | $apiDomain = str_replace('https://', '', $apiDomain); |
215 | 215 | $moduleNamespace = $namespace; |
216 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
216 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
217 | 217 | $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers'; |
218 | 218 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
219 | 219 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | private function buildPolicyArray($class, $namespace) |
237 | 237 | { |
238 | 238 | $moduleNamespace = $namespace; |
239 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
239 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
240 | 240 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
241 | 241 | |
242 | 242 | return [ |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getCommands(): array |
278 | 278 | { |
279 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
279 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function getRoutes(): array |
286 | 286 | { |
287 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
287 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function getConfigs(): array |
294 | 294 | { |
295 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
295 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getFactories(): array |
302 | 302 | { |
303 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
303 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function getMigrations(): array |
310 | 310 | { |
311 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
311 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getSeeders(): array |
318 | 318 | { |
319 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
319 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function getModels(): array |
326 | 326 | { |
327 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
327 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -332,6 +332,6 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function getPolicies(): array |
334 | 334 | { |
335 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
335 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
336 | 336 | } |
337 | 337 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Modules\User\Entities\User; |
4 | 4 | |
5 | 5 | $factory->define( |
6 | - User::class, function (Faker\Generator $faker) { |
|
6 | + User::class, function(Faker\Generator $faker) { |
|
7 | 7 | return [ |
8 | 8 | 'provider' => 'database', |
9 | 9 | 'name' => $faker->name, |