*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'content' => $this->content, 'media' => $this->media, 'status' => $this->status?->value, 'scheduled_at' => $this->scheduled_at?->format('Y-m-d H:i:s'), 'published_at' => $this->published_at?->format('Y-m-d H:i:s'), 'platforms' => PostPlatformResource::collection($this->whenLoaded('postPlatforms')), 'labels' => LabelResource::collection($this->whenLoaded('labels')), 'created_at' => $this->created_at->format('Y-m-d H:i:s'), 'updated_at' => $this->updated_at->format('Y-m-d H:i:s'), ]; } }