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

31 lines
959 B
PHP
Raw 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 PlatformAccountResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
2025-08-05 21:53:49 +02:00
'platform' => $this->platform->value,
'instance_url' => $this->instance_url,
2025-08-02 15:20:09 +02:00
'username' => $this->username,
2025-08-05 21:53:49 +02:00
'settings' => $this->settings,
2025-08-02 15:20:09 +02:00
'is_active' => $this->is_active,
2025-08-05 21:53:49 +02:00
'last_tested_at' => $this->last_tested_at?->toISOString(),
'status' => $this->status,
2025-08-02 15:20:09 +02:00
'created_at' => $this->created_at->toISOString(),
'updated_at' => $this->updated_at->toISOString(),
'channels' => PlatformChannelResource::collection($this->whenLoaded('channels')),
];
}
}