@@ -40,12 +40,12 @@ |
||
40 | 40 | */ |
41 | 41 | protected $table = 'users'; |
42 | 42 | |
43 | - protected $with = ['roles','permissions']; |
|
43 | + protected $with = [ 'roles', 'permissions' ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - protected $guarded = []; |
|
48 | + protected $guarded = [ ]; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @return mixed |
@@ -33,7 +33,7 @@ |
||
33 | 33 | 'created_at' => $this->created_at, |
34 | 34 | 'updated_at' => $this->updated_at, |
35 | 35 | 'roles' => collect(RoleResource::collection($this->roles)->toArray(null))->flatten(), |
36 | - 'permissions' => collect(PermissionResource::collection($this->getAllPermissions() )->toArray(null))->flatten() |
|
36 | + 'permissions' => collect(PermissionResource::collection($this->getAllPermissions())->toArray(null))->flatten() |
|
37 | 37 | ]; |
38 | 38 | } |
39 | 39 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | public function setRoles($id, array $roles): void |
71 | 71 | { |
72 | 72 | if (!in_array(Role::USER, $roles)) |
73 | - $roles[] = Role::USER; |
|
73 | + $roles[ ] = Role::USER; |
|
74 | 74 | $this->find($id)->syncRoles($roles); |
75 | 75 | } |
76 | 76 | } |
@@ -22,13 +22,15 @@ discard block |
||
22 | 22 | |
23 | 23 | public function find($id): ?User |
24 | 24 | { |
25 | - if ($id instanceof User) |
|
26 | - return $id; |
|
25 | + if ($id instanceof User) { |
|
26 | + return $id; |
|
27 | + } |
|
27 | 28 | |
28 | 29 | $user = User::find($id); |
29 | 30 | |
30 | - if ($user === null) |
|
31 | - throw new NotFoundHttpException(); |
|
31 | + if ($user === null) { |
|
32 | + throw new NotFoundHttpException(); |
|
33 | + } |
|
32 | 34 | |
33 | 35 | return $user; |
34 | 36 | } |
@@ -69,8 +71,9 @@ discard block |
||
69 | 71 | |
70 | 72 | public function setRoles($id, array $roles): void |
71 | 73 | { |
72 | - if (!in_array(Role::USER, $roles)) |
|
73 | - $roles[] = Role::USER; |
|
74 | + if (!in_array(Role::USER, $roles)) { |
|
75 | + $roles[] = Role::USER; |
|
76 | + } |
|
74 | 77 | $this->find($id)->syncRoles($roles); |
75 | 78 | } |
76 | 79 | } |
@@ -22,5 +22,5 @@ |
||
22 | 22 | |
23 | 23 | public function delete($id): bool; |
24 | 24 | |
25 | - public function heartbeat($id,$data): void; |
|
25 | + public function heartbeat($id, $data): void; |
|
26 | 26 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | class MachineUpdatedEvent extends Event implements ShouldBroadcast |
18 | 18 | { |
19 | - public $listeners = []; |
|
19 | + public $listeners = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var Machine |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function broadcastOn() |
37 | 37 | { |
38 | - return new PrivateChannel('user.' . $this->machine->user_id); |
|
38 | + return new PrivateChannel('user.'.$this->machine->user_id); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function broadcastAs() |
@@ -53,8 +53,8 @@ |
||
53 | 53 | { |
54 | 54 | $this->update($id, [ |
55 | 55 | 'last_heartbeat' => Carbon::now(), |
56 | - 'memory_usage' => $data['memory_usage'], |
|
57 | - 'cpu_usage' => $data['cpu_usage'] |
|
56 | + 'memory_usage' => $data[ 'memory_usage' ], |
|
57 | + 'cpu_usage' => $data[ 'cpu_usage' ] |
|
58 | 58 | ]); |
59 | 59 | } |
60 | 60 |
@@ -23,8 +23,9 @@ |
||
23 | 23 | |
24 | 24 | public function find($id): ?Machine |
25 | 25 | { |
26 | - if ($id instanceof Machine) |
|
27 | - return $id; |
|
26 | + if ($id instanceof Machine) { |
|
27 | + return $id; |
|
28 | + } |
|
28 | 29 | return Machine::find($id); |
29 | 30 | } |
30 | 31 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function register() |
18 | 18 | { |
19 | - //Telescope::night(); |
|
19 | + //Telescope::night(); |
|
20 | 20 | |
21 | 21 | Telescope::filter(function (IncomingEntry $entry) { |
22 | 22 | if ($this->app->environment('local')) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | //Telescope::night(); |
20 | 20 | |
21 | - Telescope::filter(function (IncomingEntry $entry) { |
|
21 | + Telescope::filter(function(IncomingEntry $entry) { |
|
22 | 22 | if ($this->app->environment('local')) { |
23 | 23 | return true; |
24 | 24 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function gate() |
41 | 41 | { |
42 | - Gate::define('viewTelescope', function ($user) { |
|
42 | + Gate::define('viewTelescope', function($user) { |
|
43 | 43 | return in_array($user->email, [ |
44 | 44 | // |
45 | 45 | ]); |
@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('user.{id}', function ($user, $id) { |
|
14 | +Broadcast::channel('user.{id}', function($user, $id) { |
|
15 | 15 | return $user->id === (int) $id; |
16 | 16 | }); |
@@ -56,32 +56,32 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($unwrap) { |
59 | - return json_decode($content, true)['data'] ?? json_decode($content, true); |
|
59 | + return json_decode($content, true)[ 'data' ] ?? json_decode($content, true); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return json_decode($content, true); |
63 | 63 | } |
64 | 64 | |
65 | - protected function http(string $method, string $route, array $payload = []) |
|
65 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
66 | 66 | { |
67 | 67 | return $this->sendRequest($method, $route, $payload, true); |
68 | 68 | } |
69 | 69 | |
70 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
70 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
71 | 71 | { |
72 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
73 | - 'Authorization' => 'Bearer ' . $this->getAuth0Service()->getTestUserToken()->id_token, |
|
74 | - ] : []); |
|
72 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
73 | + 'Authorization' => 'Bearer '.$this->getAuth0Service()->getTestUserToken()->id_token, |
|
74 | + ] : [ ]); |
|
75 | 75 | } |
76 | 76 | |
77 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
77 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
78 | 78 | { |
79 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
80 | - 'Authorization' => 'Bearer ' . $token, |
|
81 | - ] : []); |
|
79 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
80 | + 'Authorization' => 'Bearer '.$token, |
|
81 | + ] : [ ]); |
|
82 | 82 | } |
83 | 83 | |
84 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
84 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
85 | 85 | { |
86 | 86 | return $this->sendRequest($method, $route, $payload, false); |
87 | 87 | } |
@@ -31,8 +31,9 @@ |
||
31 | 31 | |
32 | 32 | protected function getAuth0Service() |
33 | 33 | { |
34 | - if ($this->auth0 === null) |
|
35 | - $this->auth0 = $this->app->make(Auth0UserRepository::class); |
|
34 | + if ($this->auth0 === null) { |
|
35 | + $this->auth0 = $this->app->make(Auth0UserRepository::class); |
|
36 | + } |
|
36 | 37 | return $this->auth0; |
37 | 38 | } |
38 | 39 |