31 lines
No EOL
959 B
PHP
31 lines
No EOL
959 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' => $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')),
|
|
];
|
|
}
|
|
} |