31 lines
No EOL
1,001 B
PHP
31 lines
No EOL
1,001 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PlatformChannelResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'platform_instance_id' => $this->platform_instance_id,
|
|
'channel_id' => $this->channel_id,
|
|
'name' => $this->name,
|
|
'display_name' => $this->display_name,
|
|
'description' => $this->description,
|
|
'is_active' => $this->is_active,
|
|
'created_at' => $this->created_at->toISOString(),
|
|
'updated_at' => $this->updated_at->toISOString(),
|
|
'platform_instance' => new PlatformInstanceResource($this->whenLoaded('platformInstance')),
|
|
'routes' => RouteResource::collection($this->whenLoaded('routes')),
|
|
];
|
|
}
|
|
} |