# Comment Model
DB Table Name | {wp_db_prefix}_fbs_comment |
---|---|
Schema | Check Schema |
Source File | fluent-boards/app/Models/Comment.php |
Name Space | FluentBoards\App\Models |
Class | FluentBoards\App\Models\Comment |
# Attributes
Attribute | Data Type | Comment |
---|---|---|
id | INT UNSIGNED Auto Increment | Primary key of the comment |
board_id | INT UNSIGNED | ID of the associated board |
task_id | INT UNSIGNED | ID of the associated task |
parent_id | BIGINT UNSIGNED NULL | ID of the parent comment if it's a reply |
type | VARCHAR(50) DEFAULT 'comment' | Type of the entry (comment, note, reply) |
privacy | VARCHAR(50) DEFAULT 'public' | Privacy level of the comment (public, private) |
status | VARCHAR(50) DEFAULT 'published' | Status of the comment (published, draft, spam) |
author_name | VARCHAR(192) DEFAULT '' | Name of the comment author |
author_email | VARCHAR(192) DEFAULT '' | Email of the comment author |
author_ip | VARCHAR(50) DEFAULT '' | IP address of the comment author |
description | TEXT NULL | Content of the comment |
created_by | BIGINT UNSIGNED NULL | ID of the user who created the comment |
created_at | TIMESTAMP NULL | Timestamp when the comment was created |
updated_at | TIMESTAMP NULL | Timestamp when the comment was last updated |
# Usage
Please check Model Basic for Common methods.
# Accessing Attributes
$comment = FluentBoards\App\Models\Comment::find(1);
$comment->id; // returns id
$comment->author_name; // returns author_name
.......
1
2
3
4
5
6
7
2
3
4
5
6
7
# Relations
This model has the following relationships that you can use
# user
Access the user who created the comment
- return
FluentBoards\App\Models\User
Model Collection
# Example:
$user = $comment->user;
1
# task
Access the associated task of the comment
- return
FluentBoards\App\Models\Task
Model Collection
# Example:
$task = $comment->task;
1
# replies
Access the replies to the comment
- return
FluentBoards\App\Models\Comment
Model Collection
# Example:
$replies = $comment->replies;
1
# parentComment
Access the parent comment if it exists
- return
FluentBoards\App\Models\Comment
Model Collection
# Example:
$parent = $comment->parentComment;
1
# images
Access images associated with the comment
- return
FluentBoards\App\Models\CommentImage
Model Collection
# Example:
$images = $comment->images;
1