Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PlatformAccountResource
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 toArray
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8class PlatformAccountResource extends JsonResource
9{
10    /**
11     * Transform the resource into an array.
12     *
13     * @return array<string, mixed>
14     */
15    public function toArray(Request $request): array
16    {
17        return [
18            'id' => $this->id,
19            'platform_instance_id' => $this->platform_instance_id,
20            'account_id' => $this->account_id,
21            'username' => $this->username,
22            'display_name' => $this->display_name,
23            'description' => $this->description,
24            'is_active' => $this->is_active,
25            'created_at' => $this->created_at->toISOString(),
26            'updated_at' => $this->updated_at->toISOString(),
27            'platform_instance' => new PlatformInstanceResource($this->whenLoaded('platformInstance')),
28            'channels' => PlatformChannelResource::collection($this->whenLoaded('channels')),
29        ];
30    }
31}