flux:x-comment-review 是 Flux Pro Max 提供的评论管理后台组件,用于管理员审核、批准或删除用户评论。支持状态筛选、内容搜索、排序等功能,适合在管理后台中使用。
使用 flux:x-comment-review 组件前,需要先发布迁移文件并运行迁移。
php artisan flux-pro-max:publish x-comment --migrations
php artisan flux-pro-max:publish x-comment --views
php artisan flux-pro-max:publish x-comment --configs
php artisan flux-pro-max:publish x-comment --langs
php artisan migrate
npm run build
迁移将创建(或复用)以下数据表:
在管理后台页面中使用评论审核组件:
{{-- 基础用法 --}}
<flux:x-comment-review />
{{-- 自定义每页数量 --}}
<flux:x-comment-review :per-page="30" />
通过 is-admin 控制当前用户是否具有管理员权限。只有管理员才能查看和操作评论列表,非管理员将看到权限不足的提示。默认值为 true。
{{-- 根据用户角色动态设置权限 --}}
<flux:x-comment-review :is-admin="auth()->user()?->isAdmin()" />
{{-- 或使用 Gate 权限检查 --}}
<flux:x-comment-review :is-admin="Gate::allows('manage-comments')" />
通过 per-page 控制每页显示的评论数量,支持 1-100 之间的值,默认值为 10。
|
ID
|
|
|
评论内容
|
|
|
操作
|
|---|---|---|---|---|---|---|
| 30 | 终小南 | avatar-501 |
谁啊这是。。。。
|
2025-12-28 16:32 |
|
|
| 29 | 终小南 | article-101 |
来一条消息在这时
|
2025-12-28 16:32 |
|
|
| 28 | 终小南 | promax.docs.components.comment |
你好啊,这是啥啊。
|
2025-12-28 16:32 |
|
|
| 27 | 终小南 | promax.docs.components.comment |
内容测试一下。
|
2025-12-28 16:31 |
|
|
| 26 | Solo | article-123 |
Emoji
直接输入 Emoji:
😀 🎉 🚀 ⭐ 👍
|
2025-12-05 08:50 |
|
{{-- 每页显示 5 条评论 --}}
<flux:x-comment-review :per-page="5" />
{{-- 每页显示 50 条评论 --}}
<flux:x-comment-review :per-page="50" />
通过 label 和 description 自定义评论审核区的标题和描述文字。
|
ID
|
|
|
评论内容
|
|
|
操作
|
|---|---|---|---|---|---|---|
| 30 | 终小南 | avatar-501 |
谁啊这是。。。。
|
2025-12-28 16:32 |
|
|
| 29 | 终小南 | article-101 |
来一条消息在这时
|
2025-12-28 16:32 |
|
|
| 28 | 终小南 | promax.docs.components.comment |
你好啊,这是啥啊。
|
2025-12-28 16:32 |
|
|
| 27 | 终小南 | promax.docs.components.comment |
内容测试一下。
|
2025-12-28 16:31 |
|
|
| 26 | Solo | article-123 |
Emoji
直接输入 Emoji:
😀 🎉 🚀 ⭐ 👍
|
2025-12-05 08:50 |
|
|
| 25 | Solo | article-123 |
特殊符号转义
使用反斜杠转义:
\* \_ \# \[ \] \( \...
|
2025-12-05 08:50 |
|
|
| 24 | Solo | article-123 |
分隔线
---
或
***
|
2025-12-05 08:49 |
|
|
| 23 | Solo | article-123 |
基础表格:
| 列1 | 列2 | 列3 |
|-----|-----|-----|...
基础表格: | 列1 | 列2 | 列3 | |-----|-----|-----| | 数据1 | 数据2 | 数据3 | | A | B | C | 带对齐的表格: | 左对齐 | 居中对齐 | 右对齐 | |:-------|:--------:|-------:| | 内容1 | 内容2 | 内容3 | |
2025-12-05 08:48 |
|
|
| 22 | Solo | article-123 |
代码块
JavaScript:
```javascript
function greet...
代码块 JavaScript: ```javascript function greet(name) { console.log(`Hello, ${name}!`); return true; } ``` Python: ```python def calculate_sum(a, b): """计算两个数的和""" return a + b ``` |
2025-12-05 08:48 |
|
|
| 21 | Solo | article-123 |
引用
> 这是一段引用文本。
>
> 引用可以有多个段落...
|
2025-12-05 08:47 |
|
{{-- 自定义标签和描述 --}}
<flux:x-comment-review
label="用户评论审核"
description="审核、批准或删除用户提交的评论"
/>
{{-- 自定义标签 --}}
<flux:x-comment-review label="评论管理" />
{{-- 隐藏标签 --}}
<flux:x-comment-review :label="null" />
评论有三种状态,可以通过筛选器进行过滤:
管理员可以对评论执行以下操作:
以下是在管理后台中使用评论审核组件的一个完整示例,包含实际效果与可拷贝代码:
{{-- 在管理后台页面中使用 --}}
<flux:x-comment-review
:is-admin="($user = auth()->user()) && method_exists($user, 'isAdmin') ? $user->isAdmin() : false"
:per-page="30"
label="评论审核"
description="管理用户提交的所有评论"
/>
下面列出了 flux:x-comment-review 支持的所有属性。
|
属性
|
类型
|
默认值
|
说明
|
|---|---|---|---|
| is-admin | bool | true | 是否具有管理员权限。非管理员无法查看和操作评论列表。 |
| per-page | int | 10 | 每页显示的评论数量,支持 1-100。 |
| label | string|null | '评论' | 评论审核区标题。设置为 null 可隐藏。 |
| description | string|null | null | 评论审核区描述文字。设置为 null 可隐藏。 |
基础表格: | 列1 | 列2 | 列3 | |-----|-----|-----| | 数据1 | 数据2 | 数据3 | | A | B | C | 带对齐的表格: | 左对齐 | 居中对齐 | 右对齐 | |:-------|:--------:|-------:| | 内容1 | 内容2 | 内容3 |
代码块 JavaScript: ```javascript function greet(name) { console.log(`Hello, ${name}!`); return true; } ``` Python: ```python def calculate_sum(a, b): """计算两个数的和""" return a + b ```