fedi-feed-router/backend/app/Http/Resources/PlatformAccountResource.php

31 lines
No EOL
1,023 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PlatformAccountResource 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,
'account_id' => $this->account_id,
'username' => $this->username,
'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')),
'channels' => PlatformChannelResource::collection($this->whenLoaded('channels')),
];
}
}