fedi-feed-router/app/Http/Resources/PlatformChannelResource.php

33 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2025-08-02 15:20:09 +02:00
<?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,
2025-08-12 01:01:38 +02:00
'language_id' => $this->language_id,
2025-08-02 15:20:09 +02:00
'is_active' => $this->is_active,
'created_at' => $this->created_at->toISOString(),
'updated_at' => $this->updated_at->toISOString(),
'platform_instance' => new PlatformInstanceResource($this->whenLoaded('platformInstance')),
2025-08-10 01:26:56 +02:00
'platform_accounts' => PlatformAccountResource::collection($this->whenLoaded('platformAccounts')),
2025-08-02 15:20:09 +02:00
'routes' => RouteResource::collection($this->whenLoaded('routes')),
];
}
}