@@ -13,11 +13,11 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | 'supportsCredentials' => true, |
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 | ]; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function handle() |
37 | 37 | { |
38 | - Artisan::call('vendor:publish',[ |
|
38 | + Artisan::call('vendor:publish', [ |
|
39 | 39 | "--provider"=>"Laravel\Horizon\HorizonServiceProvider" |
40 | 40 | ]); |
41 | 41 | $this->info('Horizon assets published.'); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'production' => [ |
75 | 75 | 'supervisor-1' => [ |
76 | 76 | 'connection' => 'redis', |
77 | - 'queue' => ['default'], |
|
77 | + 'queue' => [ 'default' ], |
|
78 | 78 | 'balance' => 'simple', |
79 | 79 | 'processes' => 10, |
80 | 80 | 'tries' => 3, |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'local' => [ |
85 | 85 | 'supervisor-1' => [ |
86 | 86 | 'connection' => 'redis', |
87 | - 'queue' => ['default'], |
|
87 | + 'queue' => [ 'default' ], |
|
88 | 88 | 'balance' => 'simple', |
89 | 89 | 'processes' => 3, |
90 | 90 | 'tries' => 3, |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function handle() |
37 | 37 | { |
38 | - Artisan::call('vendor:publish',[ |
|
38 | + Artisan::call('vendor:publish', [ |
|
39 | 39 | "--tag" => "telescope-assets", |
40 | 40 | "--force" => true |
41 | 41 | ]); |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | private function loadRoutes() |
80 | 80 | { |
81 | 81 | foreach ($this->bootstrapService->getRoutes() as $route) { |
82 | - $path = $route['path']; |
|
82 | + $path = $route[ 'path' ]; |
|
83 | 83 | Route::group([ |
84 | - 'prefix' => 'v1/' . str_plural($route['module']), |
|
85 | - 'namespace' => $route['controller'], |
|
86 | - 'domain' => $route['domain'], |
|
87 | - 'middleware' => ['api'], |
|
88 | - ], function () use ($path) { |
|
84 | + 'prefix' => 'v1/'.str_plural($route[ 'module' ]), |
|
85 | + 'namespace' => $route[ 'controller' ], |
|
86 | + 'domain' => $route[ 'domain' ], |
|
87 | + 'middleware' => [ 'api' ], |
|
88 | + ], function() use ($path) { |
|
89 | 89 | require $path; |
90 | 90 | }); |
91 | - Route::model($route['module'], $route['model']); |
|
91 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | protected function loadConfigs() |
101 | 101 | { |
102 | 102 | foreach ($this->bootstrapService->getConfigs() as $config) { |
103 | - if (isset($config['filename']) && is_string($config['filename'])) { |
|
104 | - $fileName = $config['filename']; |
|
105 | - $configName = strtolower(explode('.',$fileName)[0]); |
|
103 | + if (isset($config[ 'filename' ]) && is_string($config[ 'filename' ])) { |
|
104 | + $fileName = $config[ 'filename' ]; |
|
105 | + $configName = strtolower(explode('.', $fileName)[ 0 ]); |
|
106 | 106 | $this->mergeConfigFrom( |
107 | - $config['path'], $configName |
|
107 | + $config[ 'path' ], $configName |
|
108 | 108 | ); |
109 | 109 | } |
110 | 110 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | foreach ($this->bootstrapService->getFactories() as $factory) { |
121 | 121 | if (!$this->app->environment('production')) { |
122 | - app(Factory::class)->load($factory['path']); |
|
122 | + app(Factory::class)->load($factory[ 'path' ]); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | public function loadMigrations() |
133 | 133 | { |
134 | 134 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
135 | - $this->loadMigrationsFrom($migration['path']); |
|
135 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | private function loadPolicies() |
140 | 140 | { |
141 | 141 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
142 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
143 | - Gate::policy($policy['model'], $policy['class']); |
|
142 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
143 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | { |
150 | 150 | $app = $this->app; |
151 | 151 | $service = $this->bootstrapService; |
152 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
153 | - return new SeedCommand($app['db'], $service); |
|
152 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
153 | + return new SeedCommand($app[ 'db' ], $service); |
|
154 | 154 | }); |
155 | 155 | } |
156 | 156 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | foreach ($this->bootstrapService->getModels() as $model) { |
169 | 169 | if (class_implements_interface($model, Ownable::class)) { |
170 | 170 | Gate::policy($model, OwnershipPolicy::class); |
171 | - Gate::define('access', OwnershipPolicy::class . '@access'); |
|
171 | + Gate::define('access', OwnershipPolicy::class.'@access'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | private function loadListeners() |
185 | 185 | { |
186 | 186 | foreach ($this->bootstrapService->getEvents() as $event) { |
187 | - foreach ($event['listeners'] as $listener) { |
|
188 | - Event::listen($event['class'], $listener); |
|
187 | + foreach ($event[ 'listeners' ] as $listener) { |
|
188 | + Event::listen($event[ 'class' ], $listener); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
@@ -176,8 +176,9 @@ discard block |
||
176 | 176 | private function loadServiceProviders() |
177 | 177 | { |
178 | 178 | foreach ($this->bootstrapService->getProviders() as $provider) { |
179 | - if ($this->passedRegistrationCondition($provider)) |
|
180 | - $this->app->register($provider); |
|
179 | + if ($this->passedRegistrationCondition($provider)) { |
|
180 | + $this->app->register($provider); |
|
181 | + } |
|
181 | 182 | } |
182 | 183 | } |
183 | 184 | |
@@ -192,8 +193,9 @@ discard block |
||
192 | 193 | |
193 | 194 | private function passedRegistrationCondition($class) |
194 | 195 | { |
195 | - if (!class_implements_interface($class, ConditionalAutoRegistration::class)) |
|
196 | - return true; |
|
196 | + if (!class_implements_interface($class, ConditionalAutoRegistration::class)) { |
|
197 | + return true; |
|
198 | + } |
|
197 | 199 | return run_class_function($class, 'registrationCondition'); |
198 | 200 | } |
199 | 201 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * ModelCacheOOP constructor. |
26 | 26 | */ |
27 | - public function __construct(string $model, array $indexes = [], $cacheTime = null) |
|
27 | + public function __construct(string $model, array $indexes = [ ], $cacheTime = null) |
|
28 | 28 | { |
29 | 29 | $this->model = $model; |
30 | 30 | $this->secondaryIndexes = $indexes; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | protected function eagerLoadRelations($model) |
69 | 69 | { |
70 | 70 | if ($model !== null) { |
71 | - return $model::eagerLoadRelations([$model])[0]; |
|
71 | + return $model::eagerLoadRelations([ $model ])[ 0 ]; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getCacheName($id, string $index = 'id') |
84 | 84 | { |
85 | - return config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)) . ':' . $index . ':' . $id; |
|
85 | + return config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)).':'.$index.':'.$id; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | private static function deleteWithPrefix($prefix) |
142 | 142 | { |
143 | 143 | $redis = self::getCacheConnection(); |
144 | - $keyPattern = Cache::getPrefix() . $prefix . '*'; |
|
144 | + $keyPattern = Cache::getPrefix().$prefix.'*'; |
|
145 | 145 | $keys = $redis->keys($keyPattern); |
146 | 146 | $redis->delete($keys); |
147 | 147 | } |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function clearModelCache() |
169 | 169 | { |
170 | - $pattern = config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)); |
|
170 | + $pattern = config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)); |
|
171 | 171 | self::deleteWithPrefix($pattern); |
172 | 172 | } |
173 | 173 | |
174 | 174 | public function enabled(): bool |
175 | 175 | { |
176 | - return (bool)config('model.caching'); |
|
176 | + return (bool) config('model.caching'); |
|
177 | 177 | } |
178 | 178 | } |
@@ -57,8 +57,9 @@ |
||
57 | 57 | |
58 | 58 | if ($modelId === null) { |
59 | 59 | $model = ($this->model)::where($index, $key)->first(); |
60 | - if ($model !== null) |
|
61 | - $this->store($model); |
|
60 | + if ($model !== null) { |
|
61 | + $this->store($model); |
|
62 | + } |
|
62 | 63 | return $model; |
63 | 64 | } |
64 | 65 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('users', function (Blueprint $table) { |
|
15 | + Schema::create('users', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('identity_id')->unique(); |
18 | 18 | $table->string('email'); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct() |
30 | 30 | { |
31 | 31 | if (!isset($this->collection) || $this->collection === '') { |
32 | - throw new InternalErrorException('Collection name must be specified on migration: ' . get_called_class()); |
|
32 | + throw new InternalErrorException('Collection name must be specified on migration: '.get_called_class()); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | final public function up() |
42 | 42 | { |
43 | 43 | if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
44 | - Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
|
44 | + Schema::connection($this->connection)->create($this->collection, function(Blueprint $collection) { |
|
45 | 45 | if (method_exists($this, 'migrate')) |
46 | 46 | $this->migrate($collection); |
47 | 47 | }); |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | { |
43 | 43 | if (!Schema::connection($this->connection)->hasTable($this->collection)) { |
44 | 44 | Schema::connection($this->connection)->create($this->collection, function (Blueprint $collection) { |
45 | - if (method_exists($this, 'migrate')) |
|
46 | - $this->migrate($collection); |
|
45 | + if (method_exists($this, 'migrate')) { |
|
46 | + $this->migrate($collection); |
|
47 | + } |
|
47 | 48 | }); |
48 | 49 | } |
49 | 50 | } |
@@ -56,8 +57,9 @@ discard block |
||
56 | 57 | final public function down() |
57 | 58 | { |
58 | 59 | if (Schema::connection($this->connection)->hasTable($this->collection)) { |
59 | - if (method_exists($this, 'destroy')) |
|
60 | - $this->destroy(); |
|
60 | + if (method_exists($this, 'destroy')) { |
|
61 | + $this->destroy(); |
|
62 | + } |
|
61 | 63 | Schema::connection($this->connection)->drop($this->collection); |
62 | 64 | } |
63 | 65 | } |
@@ -24,15 +24,15 @@ |
||
24 | 24 | /* If refresh fails. It usually means the database was only partially migrated or seeded. |
25 | 25 | ** Start fresh if that's the case |
26 | 26 | **/ |
27 | - try{ |
|
27 | + try { |
|
28 | 28 | $this->artisan('migrate:refresh'); |
29 | - } catch (\Exception $e){ |
|
29 | + } catch (\Exception $e) { |
|
30 | 30 | $this->artisan('cache:model:clear'); |
31 | 31 | $this->artisan('migrate:fresh'); |
32 | 32 | $this->artisan('migrate:refresh'); |
33 | 33 | } |
34 | 34 | $this->artisan('db:seed'); |
35 | - $this->beforeApplicationDestroyed(function () { |
|
35 | + $this->beforeApplicationDestroyed(function() { |
|
36 | 36 | RefreshDatabaseState::$migrated = false; |
37 | 37 | }); |
38 | 38 | } |