@@ -49,7 +49,7 @@ |
||
| 49 | 49 | 'cpu_usage' => rand(0, 100), |
| 50 | 50 | 'memory_usage' => rand(1, $machine->memory_available), |
| 51 | 51 | ]); |
| 52 | - $this->machineService->update($machine, ['online' => (bool)rand(0, 1)]); |
|
| 52 | + $this->machineService->update($machine, [ 'online' => (bool) rand(0, 1) ]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Faker\Generator as Faker; |
| 4 | 4 | |
| 5 | -$factory->define(Modules\Machine\Entities\Machine::class, function (Faker $faker) { |
|
| 5 | +$factory->define(Modules\Machine\Entities\Machine::class, function(Faker $faker) { |
|
| 6 | 6 | $os = [ |
| 7 | 7 | 'MAC', |
| 8 | 8 | 'WINDOWS', |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | 'memory_usage' => rand(512, 8192), |
| 22 | 22 | 'memory_available' => 8192, |
| 23 | 23 | 'cpu_usage' => rand(0, 100), |
| 24 | - 'cpu_clock' => rand(3,5), |
|
| 24 | + 'cpu_clock' => rand(3, 5), |
|
| 25 | 25 | 'online' => $faker->boolean |
| 26 | 26 | ]; |
| 27 | 27 | }); |
@@ -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 | 'online' => true |
| 59 | 59 | ]); |
| 60 | 60 | } |
@@ -102,8 +102,9 @@ |
||
| 102 | 102 | */ |
| 103 | 103 | public function before($user, $ability) |
| 104 | 104 | { |
| 105 | - if ($user->isAdmin()) |
|
| 106 | - return true; |
|
| 105 | + if ($user->isAdmin()) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 107 | 108 | } |
| 108 | 109 | |
| 109 | 110 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | class ApiResponse |
| 13 | 13 | { |
| 14 | - public static function deleted(){ |
|
| 14 | + public static function deleted() { |
|
| 15 | 15 | return \response()->noContent(204); |
| 16 | 16 | } |
| 17 | 17 | } |
@@ -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 | } |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | trait HandlesOwnership |
| 16 | 16 | { |
| 17 | - public function isOwner(?Ownable $model){ |
|
| 17 | + public function isOwner(?Ownable $model) { |
|
| 18 | 18 | |
| 19 | - if($model === null) |
|
| 19 | + if ($model === null) |
|
| 20 | 20 | throw new NotFoundHttpException("Could not found resouce."); |
| 21 | 21 | |
| 22 | 22 | $this->authorize('access', $model); |
@@ -16,8 +16,9 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function isOwner(?Ownable $model){ |
| 18 | 18 | |
| 19 | - if($model === null) |
|
| 20 | - throw new NotFoundHttpException("Could not found resouce."); |
|
| 19 | + if($model === null) { |
|
| 20 | + throw new NotFoundHttpException("Could not found resouce."); |
|
| 21 | + } |
|
| 21 | 22 | |
| 22 | 23 | $this->authorize('access', $model); |
| 23 | 24 | } |