$this->id, 'chat_thread_id' => $this->chat_thread_id, 'sender_user_id' => $this->sender_user_id, 'message' => $this->message, 'attachment' => json_decode($this->attachment) != null ? UploadResource::collection(Upload::whereIn('id', json_decode($this->attachment))->get()) : null, 'seen' => $this->seen, // 'attachment_type' => $this->attachment, ]; } }