Skip to content

Chat ​

File: src/Entities/Chat.php
Namespace: Unusualify\Modularous\Entities
Extends: Model

Chat room attached to a parent model via a polymorphic relationship. A chat contains ordered messages, supports pinned messages, and exposes file attachments collected from its messages.

Fillable Attributes ​

AttributeTypeDescription
chatable_idintParent model ID
chatable_typestringParent model class

Relationships ​

chatable(): MorphTo ​

The parent model this chat is associated with.

messages(): HasMany ​

All ChatMessage records in this chat.

latestMessage(): HasOne ​

The most recent message (using latestOfMany('created_at')).

fileponds(): HasManyThrough ​

All Filepond uploads through messages in this chat.

Accessors ​

AccessorTypeDescription
attachmentsCollectionAll fileponds with role attachments, formatted via mediableFormat()
pinned_messageChatMessage|nullThe currently pinned message

Table ​

Resolved from modularous.tables.chats.