| Total Complexity | 2 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class MachineTransformer extends Transformer |
||
| 17 | { |
||
| 18 | public $relations = [ |
||
| 19 | 'user' |
||
| 20 | ]; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Transform the resource into an array. |
||
| 24 | * |
||
| 25 | * @param \Illuminate\Http\Request $request |
||
| 26 | * |
||
| 27 | * @return array |
||
| 28 | */ |
||
| 29 | public function toArray($request) |
||
| 30 | { |
||
| 31 | return [ |
||
| 32 | 'id' => $this->id, |
||
|
|
|||
| 33 | 'user_id' => $this->user_id, |
||
| 34 | 'name' => $this->name, |
||
| 35 | 'hostname' => $this->hostname, |
||
| 36 | 'username' => $this->username, |
||
| 37 | 'os' => $this->os, |
||
| 38 | 'hash' => $this->hash, |
||
| 39 | 'active' => $this->active, |
||
| 40 | 'ip_address' => $this->ip_address, |
||
| 41 | 'mac_address' => $this->mac_address, |
||
| 42 | 'memory_usage' => $this->memory_usage, |
||
| 43 | 'memory_available' => $this->memory_available, |
||
| 44 | 'cpu_usage' => $this->cpu_usage, |
||
| 45 | 'cpu_clock' => 5, |
||
| 46 | 'online' => true, |
||
| 47 | 'last_heartbeat' => $this->last_heartbeat ?? null, |
||
| 48 | 'created_at' => $this->created_at, |
||
| 49 | 'updated_at' => $this->updated_at, |
||
| 50 | ]; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function transformUser(User $user) |
||
| 56 | } |
||
| 57 | |||
| 59 |