@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @var array |
27 | 27 | */ |
28 | - protected $guarded = []; |
|
28 | + protected $guarded = [ ]; |
|
29 | 29 | /** |
30 | 30 | * The attributes that should be cast to native types. |
31 | 31 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function markAsRead() |
53 | 53 | { |
54 | 54 | if (is_null($this->read_at)) { |
55 | - $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); |
|
55 | + $this->forceFill([ 'read_at' => $this->freshTimestamp() ])->save(); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param array $models |
83 | 83 | * @return \Illuminate\Notifications\DatabaseNotificationCollection |
84 | 84 | */ |
85 | - public function newCollection(array $models = []) |
|
85 | + public function newCollection(array $models = [ ]) |
|
86 | 86 | { |
87 | 87 | return new DatabaseNotificationCollection($models); |
88 | 88 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->overrideSeedCommand(); |
31 | 31 | |
32 | - if ((bool)config('model.caching')) { |
|
32 | + if ((bool) config('model.caching')) { |
|
33 | 33 | $this->loadCacheObservers(); |
34 | 34 | } |
35 | 35 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | private function loadRoutes() |
75 | 75 | { |
76 | 76 | foreach ($this->bootstrapService->getRoutes() as $route) { |
77 | - $path = $route['path']; |
|
77 | + $path = $route[ 'path' ]; |
|
78 | 78 | Route::group([ |
79 | - 'prefix' => 'v1/' . $route['module'], |
|
80 | - 'namespace' => $route['controller'], |
|
81 | - 'domain' => $route['domain'], |
|
82 | - 'middleware' => ['api'], |
|
83 | - ], function () use ($path) { |
|
79 | + 'prefix' => 'v1/'.$route[ 'module' ], |
|
80 | + 'namespace' => $route[ 'controller' ], |
|
81 | + 'domain' => $route[ 'domain' ], |
|
82 | + 'middleware' => [ 'api' ], |
|
83 | + ], function() use ($path) { |
|
84 | 84 | require $path; |
85 | 85 | }); |
86 | - Route::model($route['module'], $route['model']); |
|
86 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | protected function loadConfigs() |
96 | 96 | { |
97 | 97 | foreach ($this->bootstrapService->getConfigs() as $config) { |
98 | - if ($config['filename'] === 'config.php') { |
|
98 | + if ($config[ 'filename' ] === 'config.php') { |
|
99 | 99 | $this->publishes([ |
100 | - $config['path'] => config_path($config['module']), |
|
100 | + $config[ 'path' ] => config_path($config[ 'module' ]), |
|
101 | 101 | ], 'config'); |
102 | 102 | $this->mergeConfigFrom( |
103 | - $config['path'], basename($config['module'], '.php') |
|
103 | + $config[ 'path' ], basename($config[ 'module' ], '.php') |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | foreach ($this->bootstrapService->getFactories() as $factory) { |
117 | 117 | if (!$this->app->environment('production')) { |
118 | - app(Factory::class)->load($factory['path']); |
|
118 | + app(Factory::class)->load($factory[ 'path' ]); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | public function loadMigrations() |
129 | 129 | { |
130 | 130 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
131 | - $this->loadMigrationsFrom($migration['path']); |
|
131 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | 135 | private function loadPolicies() |
136 | 136 | { |
137 | 137 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
138 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
139 | - Gate::policy($policy['model'], $policy['class']); |
|
138 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
139 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | { |
146 | 146 | $app = $this->app; |
147 | 147 | $service = $this->bootstrapService; |
148 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
149 | - return new SeedCommand($app['db'], $service); |
|
148 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
149 | + return new SeedCommand($app[ 'db' ], $service); |
|
150 | 150 | }); |
151 | 151 | } |
152 | 152 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | foreach ($this->bootstrapService->getModels() as $model) { |
165 | 165 | if (class_implements_interface($model, Ownable::class)) { |
166 | 166 | Gate::policy($model, OwnershipPolicy::class); |
167 | - Gate::define('access', OwnershipPolicy::class . '@access'); |
|
167 | + Gate::define('access', OwnershipPolicy::class.'@access'); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | private function loadListeners() |
180 | 180 | { |
181 | 181 | foreach ($this->bootstrapService->getEvents() as $event) { |
182 | - foreach ($event['listeners'] as $listener) { |
|
183 | - Event::listen($event['class'], $listener); |
|
182 | + foreach ($event[ 'listeners' ] as $listener) { |
|
183 | + Event::listen($event[ 'class' ], $listener); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -39,14 +39,14 @@ |
||
39 | 39 | |
40 | 40 | |
41 | 41 | if (!$user) { |
42 | - return response()->json(['error' => 'Unauthorized user.'], 401); |
|
42 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | \Auth::login($user); |
46 | 46 | } catch (InvalidTokenException $e) { |
47 | - return response()->json(['error' => 'Invalid or no token set.'], 401); |
|
47 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401); |
|
48 | 48 | } catch (CoreException $e) { |
49 | - return response()->json(['error' => $e->getMessage()], 401); |
|
49 | + return response()->json([ 'error' => $e->getMessage() ], 401); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $next($request); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function getUserByUserInfo($userInfo) |
45 | 45 | { |
46 | - return $this->upsertUser($userInfo['profile']); |
|
46 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | protected function upsertUser($profile) |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | throw new BadRequestHttpException('Missing token information: Auth0 user id is not set'); |
53 | 53 | } |
54 | 54 | $identifier = explode('|', $profile->user_id); |
55 | - $identityProvider = $identifier[0]; |
|
56 | - $id = $identifier[1]; |
|
55 | + $identityProvider = $identifier[ 0 ]; |
|
56 | + $id = $identifier[ 1 ]; |
|
57 | 57 | |
58 | 58 | $user = $this->service->find($id); |
59 | 59 | $newUser = false; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | public function broadcastOn() |
36 | 36 | { |
37 | - return new PrivateChannel('app.' . $this->user->getKey()); |
|
37 | + return new PrivateChannel('app.'.$this->user->getKey()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -28,8 +28,9 @@ |
||
28 | 28 | { |
29 | 29 | $notification = get_authenticated_user()->unreadNotifications()->find($id); |
30 | 30 | |
31 | - if ($notification === null) |
|
32 | - throw new NotFoundHttpException("Could not find notification"); |
|
31 | + if ($notification === null) { |
|
32 | + throw new NotFoundHttpException("Could not find notification"); |
|
33 | + } |
|
33 | 34 | |
34 | 35 | $notification->markAsRead(); |
35 | 36 | return response()->json([ |
@@ -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 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->assertCount(1, $notifications); |
36 | 36 | $notification = $user->unreadNotifications()->first(); |
37 | 37 | $notificationId = $notification->getKey(); |
38 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
38 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
39 | 39 | $response->assertStatus(200); |
40 | 40 | $unreadnotifications = User::find($user->getKey())->unreadNotifications; |
41 | 41 | $this->assertCount(0, $unreadnotifications); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $response->assertStatus(200); |
51 | 51 | $notificationsReponse = $this->decodeHttpContent($response->getContent()); |
52 | 52 | $notifications = NotificationResource::collection(User::find($user->getKey())->notifications)->jsonSerialize(); |
53 | - $this->assertEquals($notificationsReponse, (array)$notifications); |
|
53 | + $this->assertEquals($notificationsReponse, (array) $notifications); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function testUnreadNotificationsRoute() |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $user->notifyNow(new UserRegisteredNotification($user)); |
60 | 60 | $notification = $user->unreadNotifications()->first(); |
61 | 61 | $notificationId = $notification->getKey(); |
62 | - $response = $this->http('POST', 'v1/notifications/' . $notificationId); |
|
62 | + $response = $this->http('POST', 'v1/notifications/'.$notificationId); |
|
63 | 63 | $response->assertStatus(200); |
64 | 64 | $response = $this->http('GET', 'v1/notifications/unread'); |
65 | 65 | $response->assertStatus(200); |