The model registers two global scopes, images and replies, that always eager-load those relations. Remove them with Comment::withoutGlobalScopes(['images', 'replies']) when you do not need them.
Despite its name, this relation is defined as hasOne(Comment::class, 'parent_id', 'id'), so it returns the first reply to this comment, not its parent. To get the parent, use Comment::find($comment->parent_id).
Comment Model
{wp_db_prefix}fbs_commentsGlobal eager loads
The model registers two global scopes,
imagesandreplies, that always eager-load those relations. Remove them withComment::withoutGlobalScopes(['images', 'replies'])when you do not need them.Attributes
comment(default),noteorreplypublicorprivate. The model setsprivatewhen emptypublished(default),draftorspamAppended attributes:
fluent_boards_user_avatar()Model events
created_by,type,privacy,author_emailandauthor_name.comments_countfortype = 'comment'.Usage
Please check Model Basic for common methods.
2
3
4
5
Scopes
byTask($taskId)
privacy($privacy)
type($type)
Relations
task
FluentBoards\App\Models\Taskuser
The author (
created_by).FluentBoards\App\Models\Userreplies
Comments whose
parent_idis this comment.FluentBoards\App\Models\Commentimages
Images attached to the comment (
fbs_attachments,object_type = 'comment_image').FluentBoards\App\Models\CommentImageparentComment
WARNING
Despite its name, this relation is defined as
hasOne(Comment::class, 'parent_id', 'id'), so it returns the first reply to this comment, not its parent. To get the parent, useComment::find($comment->parent_id).FluentBoards\App\Models\Commentornull