@@ -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 | }); |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | { |
| 14 | 14 | public function injectUserId($request): array |
| 15 | 15 | { |
| 16 | - return array_merge($request->toArray(), ['user_id' => get_authenticated_user_id()]); |
|
| 16 | + return array_merge($request->toArray(), [ 'user_id' => get_authenticated_user_id() ]); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -16,67 +16,67 @@ discard block |
||
| 16 | 16 | $tableNames = config('permission.table_names'); |
| 17 | 17 | $columnNames = config('permission.column_names'); |
| 18 | 18 | |
| 19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
| 19 | + Schema::create($tableNames[ 'permissions' ], function(Blueprint $table) { |
|
| 20 | 20 | $table->increments('id'); |
| 21 | 21 | $table->string('name'); |
| 22 | 22 | $table->string('guard_name'); |
| 23 | 23 | $table->timestamps(); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
| 26 | + Schema::create($tableNames[ 'roles' ], function(Blueprint $table) { |
|
| 27 | 27 | $table->increments('id'); |
| 28 | 28 | $table->string('name'); |
| 29 | 29 | $table->string('guard_name'); |
| 30 | 30 | $table->timestamps(); |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 33 | + Schema::create($tableNames[ 'model_has_permissions' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 34 | 34 | $table->unsignedInteger('permission_id'); |
| 35 | 35 | |
| 36 | 36 | $table->string('model_type'); |
| 37 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
| 38 | - $table->index([$columnNames['model_morph_key'], 'model_type']); |
|
| 37 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
| 38 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ]); |
|
| 39 | 39 | |
| 40 | 40 | $table->foreign('permission_id') |
| 41 | 41 | ->references('id') |
| 42 | - ->on($tableNames['permissions']) |
|
| 42 | + ->on($tableNames[ 'permissions' ]) |
|
| 43 | 43 | ->onDelete('cascade'); |
| 44 | 44 | |
| 45 | - $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
| 45 | + $table->primary([ 'permission_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
| 46 | 46 | 'model_has_permissions_permission_model_type_primary'); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 49 | + Schema::create($tableNames[ 'model_has_roles' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 50 | 50 | $table->unsignedInteger('role_id'); |
| 51 | 51 | |
| 52 | 52 | $table->string('model_type'); |
| 53 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
| 54 | - $table->index([$columnNames['model_morph_key'], 'model_type']); |
|
| 53 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
| 54 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ]); |
|
| 55 | 55 | |
| 56 | 56 | $table->foreign('role_id') |
| 57 | 57 | ->references('id') |
| 58 | - ->on($tableNames['roles']) |
|
| 58 | + ->on($tableNames[ 'roles' ]) |
|
| 59 | 59 | ->onDelete('cascade'); |
| 60 | 60 | |
| 61 | - $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
| 61 | + $table->primary([ 'role_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
| 62 | 62 | 'model_has_roles_role_model_type_primary'); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
| 65 | + Schema::create($tableNames[ 'role_has_permissions' ], function(Blueprint $table) use ($tableNames) { |
|
| 66 | 66 | $table->unsignedInteger('permission_id'); |
| 67 | 67 | $table->unsignedInteger('role_id'); |
| 68 | 68 | |
| 69 | 69 | $table->foreign('permission_id') |
| 70 | 70 | ->references('id') |
| 71 | - ->on($tableNames['permissions']) |
|
| 71 | + ->on($tableNames[ 'permissions' ]) |
|
| 72 | 72 | ->onDelete('cascade'); |
| 73 | 73 | |
| 74 | 74 | $table->foreign('role_id') |
| 75 | 75 | ->references('id') |
| 76 | - ->on($tableNames['roles']) |
|
| 76 | + ->on($tableNames[ 'roles' ]) |
|
| 77 | 77 | ->onDelete('cascade'); |
| 78 | 78 | |
| 79 | - $table->primary(['permission_id', 'role_id']); |
|
| 79 | + $table->primary([ 'permission_id', 'role_id' ]); |
|
| 80 | 80 | |
| 81 | 81 | app('cache')->forget('spatie.permission.cache'); |
| 82 | 82 | }); |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $tableNames = config('permission.table_names'); |
| 93 | 93 | |
| 94 | - Schema::drop($tableNames['role_has_permissions']); |
|
| 95 | - Schema::drop($tableNames['model_has_roles']); |
|
| 96 | - Schema::drop($tableNames['model_has_permissions']); |
|
| 97 | - Schema::drop($tableNames['roles']); |
|
| 98 | - Schema::drop($tableNames['permissions']); |
|
| 94 | + Schema::drop($tableNames[ 'role_has_permissions' ]); |
|
| 95 | + Schema::drop($tableNames[ 'model_has_roles' ]); |
|
| 96 | + Schema::drop($tableNames[ 'model_has_permissions' ]); |
|
| 97 | + Schema::drop($tableNames[ 'roles' ]); |
|
| 98 | + Schema::drop($tableNames[ 'permissions' ]); |
|
| 99 | 99 | } |
| 100 | 100 | } |
@@ -37,6 +37,6 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function clearPermissionCache() :void |
| 39 | 39 | { |
| 40 | - app()['cache']->forget('spatie.permission.cache'); |
|
| 40 | + app()[ 'cache' ]->forget('spatie.permission.cache'); |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -40,16 +40,16 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | protected $table = 'users'; |
| 42 | 42 | |
| 43 | - protected $with = ['roles', 'permissions']; |
|
| 43 | + protected $with = [ 'roles', 'permissions' ]; |
|
| 44 | 44 | |
| 45 | 45 | public $cacheTime = 60; |
| 46 | 46 | |
| 47 | - public $secondaryCacheIndexes = ['identity_id']; |
|
| 47 | + public $secondaryCacheIndexes = [ 'identity_id' ]; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @var array |
| 51 | 51 | */ |
| 52 | - protected $guarded = []; |
|
| 52 | + protected $guarded = [ ]; |
|
| 53 | 53 | |
| 54 | 54 | protected $casts = [ |
| 55 | 55 | 'email_verified' => 'bool', |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | public function setRoles($id, array $roles): void |
| 72 | 72 | { |
| 73 | 73 | if (!in_array(Role::USER, $roles)) { |
| 74 | - $roles[] = Role::USER; |
|
| 74 | + $roles[ ] = Role::USER; |
|
| 75 | 75 | } |
| 76 | 76 | $this->find($id)->syncRoles($roles); |
| 77 | 77 | } |
@@ -16,7 +16,7 @@ |
||
| 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 |
@@ -56,8 +56,8 @@ |
||
| 56 | 56 | { |
| 57 | 57 | $this->update($id, [ |
| 58 | 58 | 'last_heartbeat' => Carbon::now(), |
| 59 | - 'memory_usage' => $data['memory_usage'], |
|
| 60 | - 'cpu_usage' => $data['cpu_usage'], |
|
| 59 | + 'memory_usage' => $data[ 'memory_usage' ], |
|
| 60 | + 'cpu_usage' => $data[ 'cpu_usage' ], |
|
| 61 | 61 | 'online' => true, |
| 62 | 62 | ]); |
| 63 | 63 | } |
@@ -58,32 +58,32 @@ |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($unwrap) { |
| 61 | - return json_decode($content, true)['data'] ?? json_decode($content, true); |
|
| 61 | + return json_decode($content, true)[ 'data' ] ?? json_decode($content, true); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return json_decode($content, true); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - protected function http(string $method, string $route, array $payload = []) |
|
| 67 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
| 68 | 68 | { |
| 69 | 69 | return $this->sendRequest($method, $route, $payload, true); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 72 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 73 | 73 | { |
| 74 | 74 | return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
| 75 | 75 | 'Authorization' => 'Bearer '.$this->getAuth0Service()->getTestUserToken()->id_token, |
| 76 | - ] : []); |
|
| 76 | + ] : [ ]); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 79 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 80 | 80 | { |
| 81 | 81 | return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
| 82 | 82 | 'Authorization' => 'Bearer '.$token, |
| 83 | - ] : []); |
|
| 83 | + ] : [ ]); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
| 86 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
| 87 | 87 | { |
| 88 | 88 | return $this->sendRequest($method, $route, $payload, false); |
| 89 | 89 | } |