$this->id, 'type' => $this->type, 'title' => $this->title, 'message' => $this->message, 'recipient' => $this->recipient, 'recipient_position_id' => $this->recipient_position_id, 'recipient_sector_id' => $this->recipient_sector_id, 'sent_count' => $this->when($this->sends_count !== null, $this->sends_count), 'seen_count' => $this->when($this->seen_count !== null, $this->seen_count), 'image_url' => $this->whenLoaded('media', function () { $path = $this->media->first()?->path; return $path ? Storage::disk('s3')->temporaryUrl($path, now()->addHours(24)) : null; }), 'created_by' => $this->created_by, 'created_by_user' => $this->whenLoaded('createdBy', fn() => new UserResource($this->createdBy)), 'created_at' => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'), 'updated_at' => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'), ]; } }