fedi-feed-router/app/Http/Resources/PlatformAccountResource.php
myrmidex 6784af2ff6
Some checks failed
CI / ci (push) Failing after 4m31s
25 - Fix all PHPStan errors and add mockery extension
2026-03-08 14:18:28 +01:00

37 lines
1 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin \App\Models\PlatformAccount
*/
/**
* @mixin \App\Models\PlatformAccount
*/
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' => $this->platform->value,
'instance_url' => $this->instance_url,
'username' => $this->username,
'settings' => $this->settings,
'is_active' => $this->is_active,
'last_tested_at' => $this->last_tested_at?->toISOString(),
'status' => $this->status,
'created_at' => $this->created_at->toISOString(),
'updated_at' => $this->updated_at->toISOString(),
'channels' => PlatformChannelResource::collection($this->whenLoaded('channels')),
];
}
}