Skip to content

ChatMessage ​

File: src/Entities/ChatMessage.php
Namespace: Unusualify\Modularous\Entities
Extends: Model
Traits: HasCreator, HasFileponds, ChatMessageScopes

Individual message within a Chat. Tracks read/star/pin/sent/received status and supports file attachments via Filepond. Always eager-loads its creator.

Fillable Attributes ​

AttributeTypeDescription
chat_idintParent chat ID
contentstringMessage body
is_readboolRead status
is_starredboolStarred flag
is_pinnedboolPinned flag (only one per chat)
is_sentboolSent status
is_receivedboolReceived status
edited_atdatetimeWhen the message was last edited
notified_atdatetimeWhen a notification was sent

Boot Behaviour ​

When a message is updated with is_pinned = true, all other messages in the same chat are unpinned — only one message can be pinned at a time.

Relationships ​

chat(): BelongsTo ​

The parent Chat this message belongs to.

Accessors ​

AccessorTypeDescription
user_profilearray|nullProfile data of the message creator (via get_user_profile())
attachmentsCollectionFilepond uploads with role attachments

Table ​

Resolved from modularous.tables.chat_messages.

  • Chat — parent chat room
  • HasCreator — tracks who sent the message