@@ -15,7 +15,7 @@ |
||
15 | 15 | public function boot() |
16 | 16 | { |
17 | 17 | Broadcast::routes([ |
18 | - 'middleware' => ['api'], |
|
18 | + 'middleware' => [ 'api' ], |
|
19 | 19 | 'domain' => env('API_URL'), |
20 | 20 | ]); |
21 | 21 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class WebNotificationCreatedEvent extends BroadcastNotificationCreated |
15 | 15 | { |
16 | - public function broadcastAs(){ |
|
16 | + public function broadcastAs() { |
|
17 | 17 | return 'notification.created'; |
18 | 18 | } |
19 | 19 | } |
@@ -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('create_multiple_from_factory')) { |
@@ -91,7 +91,7 @@ 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 | } |
97 | 97 | if (!function_exists('array_keys_exists')) { |
@@ -28,6 +28,6 @@ |
||
28 | 28 | |
29 | 29 | public function receivesBroadcastNotificationsOn() |
30 | 30 | { |
31 | - return strtolower(get_short_class_name($this)) . '.' . $this->getKey(); |
|
31 | + return strtolower(get_short_class_name($this)).'.'.$this->getKey(); |
|
32 | 32 | } |
33 | 33 | } |
@@ -14,23 +14,23 @@ |
||
14 | 14 | { |
15 | 15 | protected $connection = 'mysql'; |
16 | 16 | |
17 | - public static function find($id, $columns = ['*']) |
|
17 | + public static function find($id, $columns = [ '*' ]) |
|
18 | 18 | { |
19 | - if ((bool)config('model.caching')) { |
|
19 | + if ((bool) config('model.caching')) { |
|
20 | 20 | $model = ModelCache::findOrRequery($id, get_called_class()); |
21 | 21 | return self::filterFromColumns($model, $columns); |
22 | 22 | } |
23 | 23 | return self::findWithoutCache($id, $columns); |
24 | 24 | } |
25 | 25 | |
26 | - public static function findWithoutCache($id, $columns = ['*']) |
|
26 | + public static function findWithoutCache($id, $columns = [ '*' ]) |
|
27 | 27 | { |
28 | 28 | return parent::find($id, $columns); |
29 | 29 | } |
30 | 30 | |
31 | 31 | private static function filterFromColumns($model, $columns) |
32 | 32 | { |
33 | - if ($columns !== ['*']) { |
|
33 | + if ($columns !== [ '*' ]) { |
|
34 | 34 | return collect($model)->first($columns); |
35 | 35 | } |
36 | 36 | return $model; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->assertCount(2, $notifications); |
35 | 35 | $notification = $user->unreadNotifications()->first(); |
36 | 36 | $notificationId = $notification->getKey(); |
37 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
37 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
38 | 38 | $response->assertStatus(200); |
39 | 39 | $unreadnotifications = User::find($user->getKey())->unreadNotifications; |
40 | 40 | $this->assertCount(1, $unreadnotifications); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $response->assertStatus(200); |
50 | 50 | $notificationsReponse = $this->decodeHttpContent($response->getContent()); |
51 | 51 | $notifications = NotificationResource::collection(User::find($user->getKey())->notifications)->jsonSerialize(); |
52 | - $this->assertEquals($notificationsReponse, (array)$notifications); |
|
52 | + $this->assertEquals($notificationsReponse, (array) $notifications); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function testUnreadNotificationsRoute() |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $user->notifyNow(new UserRegisteredNotification($user)); |
61 | 61 | $notification = $user->unreadNotifications()->first(); |
62 | 62 | $notificationId = $notification->getKey(); |
63 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
63 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
64 | 64 | $response->assertStatus(200); |
65 | 65 | $response = $this->http('GET', 'v1/notifications/unread'); |
66 | 66 | $response->assertStatus(200); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $id = $user->getKey(); |
21 | 21 | $response = $this->http('POST', '/broadcasting/auth', [ |
22 | 22 | 'socket_id' => '125200.2991064', |
23 | - 'channel_name' => 'private-user.' . $id |
|
23 | + 'channel_name' => 'private-user.'.$id |
|
24 | 24 | ]); |
25 | 25 | $response->assertStatus(200); |
26 | 26 | $this->assertArrayHasKey('auth', $this->decodeHttpContent($response->content(), false)); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $response = $this->http('POST', '/broadcasting/auth', [ |
32 | 32 | 'socket_id' => '125200.2991064', |
33 | - 'channel_name' => 'private-user.' . new ObjectId() |
|
33 | + 'channel_name' => 'private-user.'.new ObjectId() |
|
34 | 34 | ]); |
35 | 35 | $response->assertStatus(403); |
36 | 36 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | private function storeInCache($data) |
56 | 56 | { |
57 | - file_put_contents($this->getCachePath(), '<?php return ' . var_export($data, true) . ';'); |
|
57 | + file_put_contents($this->getCachePath(), '<?php return '.var_export($data, true).';'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | private function getCachePath(): string |
85 | 85 | { |
86 | - return app()->bootstrapPath() . '/cache/' . $this->cacheFile; |
|
86 | + return app()->bootstrapPath().'/cache/'.$this->cacheFile; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | private function buildEmptyBootstrapArray() |
93 | 93 | { |
94 | - $bootstrapArray = []; |
|
94 | + $bootstrapArray = [ ]; |
|
95 | 95 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
96 | - $bootstrapArray[$key] = []; |
|
96 | + $bootstrapArray[ $key ] = [ ]; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $bootstrapArray; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $moduleNames = array_diff(scandir($path), array('..', '.')); |
109 | 109 | $modules = array(); |
110 | 110 | foreach ($moduleNames as $moduleName) { |
111 | - $modules[$moduleName] = $path . '/' . $moduleName; |
|
111 | + $modules[ $moduleName ] = $path.'/'.$moduleName; |
|
112 | 112 | } |
113 | 113 | return $modules; |
114 | 114 | } |
@@ -124,51 +124,51 @@ discard block |
||
124 | 124 | if (is_dir($modulePath)) { |
125 | 125 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
126 | 126 | $directory = ucfirst($directory); |
127 | - $directoryPath = $modulePath . '/' . $directory; |
|
128 | - $namespace = 'Modules' . '\\' . $moduleName; |
|
127 | + $directoryPath = $modulePath.'/'.$directory; |
|
128 | + $namespace = 'Modules'.'\\'.$moduleName; |
|
129 | 129 | if (is_dir($directoryPath)) { |
130 | 130 | $files = scandir($directoryPath); |
131 | 131 | foreach ($files as $fileName) { |
132 | 132 | if ($this->hasPhpExtension($fileName)) { |
133 | 133 | $className = basename($fileName, '.php'); |
134 | - $class = $namespace . '\\' . str_replace('/', '\\', $directory) . '\\' . $className; |
|
134 | + $class = $namespace.'\\'.str_replace('/', '\\', $directory).'\\'.$className; |
|
135 | 135 | switch ($key) { |
136 | 136 | case 'commands': |
137 | 137 | try { |
138 | 138 | $command = new $class(); |
139 | 139 | if ($command instanceof Command) { |
140 | - $bootstrap[$key][] = $class; |
|
140 | + $bootstrap[ $key ][ ] = $class; |
|
141 | 141 | } |
142 | 142 | } catch (\Exception $e) { |
143 | 143 | break; |
144 | 144 | } |
145 | 145 | break; |
146 | 146 | case 'routes': |
147 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath . '/' . $fileName, $namespace); |
|
147 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace); |
|
148 | 148 | break; |
149 | 149 | case 'configs': |
150 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath . '/' . $fileName, $moduleName, $fileName); |
|
150 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName); |
|
151 | 151 | break; |
152 | 152 | case 'factories': |
153 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
153 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
154 | 154 | break; |
155 | 155 | case 'migrations': |
156 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath); |
|
156 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath); |
|
157 | 157 | break; |
158 | 158 | case 'seeders': |
159 | - $bootstrap[$key][] = $class; |
|
159 | + $bootstrap[ $key ][ ] = $class; |
|
160 | 160 | break; |
161 | 161 | case 'models': |
162 | - $bootstrap[$key][] = $class; |
|
162 | + $bootstrap[ $key ][ ] = $class; |
|
163 | 163 | break; |
164 | 164 | case 'policies': |
165 | - $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace); |
|
165 | + $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace); |
|
166 | 166 | break; |
167 | 167 | case 'providers': |
168 | - $bootstrap[$key][] = $class; |
|
168 | + $bootstrap[ $key ][ ] = $class; |
|
169 | 169 | break; |
170 | 170 | case 'events': |
171 | - $bootstrap[$key][] = $this->buildEventsArray($class); |
|
171 | + $bootstrap[ $key ][ ] = $this->buildEventsArray($class); |
|
172 | 172 | break; |
173 | 173 | default: |
174 | 174 | break; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | private function hasPhpExtension(string $fileName): bool |
192 | 192 | { |
193 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4] . $fileName[-3] . $fileName[-2] . $fileName[-1]); |
|
193 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $apiDomain = str_replace('http://', '', $apiDomain); |
222 | 222 | $apiDomain = str_replace('https://', '', $apiDomain); |
223 | 223 | $moduleNamespace = $namespace; |
224 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
225 | - $controllerNamespace = $moduleNamespace . '\\' . 'Http\\Controllers'; |
|
226 | - $modelNameSpace = $moduleNamespace . '\\' . 'Entities\\' . $moduleName; |
|
224 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
225 | + $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers'; |
|
226 | + $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
|
227 | 227 | |
228 | 228 | return [ |
229 | 229 | 'path' => $path, |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | private function buildPolicyArray($class, $namespace) |
245 | 245 | { |
246 | 246 | $moduleNamespace = $namespace; |
247 | - $moduleName = explode('\\', $moduleNamespace)[1]; |
|
248 | - $modelNameSpace = $moduleNamespace . '\\' . 'Entities\\' . $moduleName; |
|
247 | + $moduleName = explode('\\', $moduleNamespace)[ 1 ]; |
|
248 | + $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName; |
|
249 | 249 | |
250 | 250 | return [ |
251 | 251 | 'class' => $class, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $listeners = array(); |
287 | 287 | foreach ($listenerProperties as $listener) { |
288 | 288 | if (class_implements_interface($listener, ListenerContract::class)) { |
289 | - $listeners[] = $listener; |
|
289 | + $listeners[ ] = $listener; |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getCommands(): array |
303 | 303 | { |
304 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
304 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function getRoutes(): array |
311 | 311 | { |
312 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
312 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function getConfigs(): array |
319 | 319 | { |
320 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
320 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getFactories(): array |
327 | 327 | { |
328 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
328 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getMigrations(): array |
335 | 335 | { |
336 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
336 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function getSeeders(): array |
343 | 343 | { |
344 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
344 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function getModels(): array |
351 | 351 | { |
352 | - return $this->loadBootstrapFromCache()['models'] ?? []; |
|
352 | + return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ]; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function getPolicies(): array |
359 | 359 | { |
360 | - return $this->loadBootstrapFromCache()['policies'] ?? []; |
|
360 | + return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ]; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function getProviders(): array |
367 | 367 | { |
368 | - return $this->loadBootstrapFromCache()['providers'] ?? []; |
|
368 | + return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ]; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -373,6 +373,6 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function getEvents(): array |
375 | 375 | { |
376 | - return $this->loadBootstrapFromCache()['events'] ?? []; |
|
376 | + return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ]; |
|
377 | 377 | } |
378 | 378 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $this->artisan('migrate:fresh'); |
23 | 23 | $this->artisan('db:seed'); |
24 | 24 | |
25 | - $this->beforeApplicationDestroyed(function () { |
|
25 | + $this->beforeApplicationDestroyed(function() { |
|
26 | 26 | $this->artisan('cache:model:clear'); |
27 | 27 | $this->artisan('migrate:rollback'); |
28 | 28 | RefreshDatabaseState::$migrated = false; |