Comment
This section covers the API endpoints for managing comments in the admin panel.
List Comments
GET /v1/admin/comments
Returns a paginated list of all comments.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
sort | string | Sort direction (asc or desc). Defaults to desc |
orderBy | string | Field to sort by. Available fields: name, comment, status |
per_page | integer | Number of items per page. Defaults to 10 |
list | boolean | If true, returns an unpaginated list of all comments |
search_text | string | Search comments by name, comment text, or commentable name |
filter[commentable] | string | Filter by commentable type |
filter[status] | string | Filter by status (rejected, approved, pending) |
filter[writerable_id] | string | Filter by writer ID |
filter[trashed] | boolean | Include trashed comments |
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://testing-api.sumaya369.net/v1/admin/comments?page=1",
"from": 1,
"last_page": 657,
"last_page_url": "http://testing-api.sumaya369.net/v1/admin/comments?page=657",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/comments?page=1",
"label": "1",
"active": true
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/comments?page=2",
"label": "2",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/comments?page=3",
"label": "3",
"active": false
},
{
"url": "http://testing-api.sumaya369.net/v1/admin/comments?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://testing-api.sumaya369.net/v1/admin/comments?page=2",
"path": "http://testing-api.sumaya369.net/v1/admin/comments",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 6568,
"comments": [
{
"id": "6e6fdad0-c370-11ef-8e15-79f205f11034",
"comment": "القرارات السهلة لأنني لا أعيرها انتباها فإنه من الممكن أن لا اكون حاسمة فيها أو ان أدع شخص ما يختار لي و هذا عن طيب خاطر و برغبتي أما القرارات المصيرية فأقرر بنفسي بعد صلاة الاستخارةالقرارات السهلة لأنني لا أعير",
"writerable_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"name": "omer khaled",
"commentable_id": "49ee6550-b301-11ef-ae03-a9dd7a389053",
"commentable_type": "App\\Models\\Bundle",
"commentable_type_name": "الباقة",
"writerable_id": "95188090-9f4b-11ef-b28e-71ceccea2f0d",
"writerable_type": "App\\Models\\Customer",
"status": "approved",
"subject": "الباقه الجديدة",
"role": "member",
"created_at": "2024-12-26",
"reply": null
},
{
"id": "98d5bee0-c36a-11ef-8bad-9173e543bbd2",
"comment": "كتاب جميل",
"writerable_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"name": "هبه}",
"commentable_id": "00d33520-4f94-11ed-a6b9-b5839356bff7",
"commentable_type": "App\\Models\\Publication",
"commentable_type_name": "الاصدار",
"writerable_id": "edf5b520-c295-11ef-afbf-7188fe42276d",
"writerable_type": "App\\Models\\Customer",
"status": "approved",
"subject": "لا تقلق",
"role": "member",
"created_at": "2024-12-26",
"reply": null
},
{
"id": "d9501c10-c125-11ef-86f8-65dd7afa6b2d",
"comment": "fffffffffffffff",
"writerable_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"name": "Ahmed Raed 3",
"commentable_id": "49ee6550-b301-11ef-ae03-a9dd7a389053",
"commentable_type": "App\\Models\\Bundle",
"commentable_type_name": "الباقة",
"writerable_id": "c6797c90-8c6c-11ef-b1d4-ab495a16f97c",
"writerable_type": "App\\Models\\Customer",
"status": "approved",
"subject": "الباقه الجديدة",
"role": "member",
"created_at": "2024-12-23",
"reply": null
},
{
"id": "ceaec330-c125-11ef-a27f-d5ba36cb085e",
"comment": "ssssssssssss",
"writerable_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"name": "Ahmed Raed 3",
"commentable_id": "49ee6550-b301-11ef-ae03-a9dd7a389053",
"commentable_type": "App\\Models\\Bundle",
"commentable_type_name": "الباقة",
"writerable_id": "c6797c90-8c6c-11ef-b1d4-ab495a16f97c",
"writerable_type": "App\\Models\\Customer",
"status": "approved",
"subject": "الباقه الجديدة",
"role": "member",
"created_at": "2024-12-23",
"reply": null
},
]
},
"status_code": 200
}
Get Comment Statistics
GET /v1/admin/comments/statistics
Returns statistics about comments including total count, published count, most active customer, and most commented items.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"total_comments": "6.7K",
"published_comments": "5.8K",
"most_active_customer": {
"avatar": "http://192.168.0.139:8080/storage/23406/980970.jpg",
"name": " ",
"email": "a.tmar-2010@hotmail.com"
},
"most_commented": [
{
"name": "مافيا الروحانية",
"comments_count": "223"
},
{
"name": "اللعبة 🎮",
"comments_count": "143"
},
{
"name": "قانون الجذب",
"comments_count": "132"
},
{
"name": "ماهو توقيت متعتك؟",
"comments_count": "127"
}
]
},
"status_code": 200
}
Get Commentables List
GET /v1/admin/comments/commentables-list
Returns a list of all items that have comments.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": [
{
"id": "204d9ae0-7532-11ed-82db-4994ff7b9907",
"name": "أهداف 2023"
},
{
"id": "b7f77b70-6f16-11ed-a597-b56bc8f8c67e",
"name": "قفزة 2023"
},
{
"id": "1ab0a790-6f1b-11ed-b447-6d37ecfb06a6",
"name": "حماية الذات"
},
{
"id": "16139dc0-b67b-11ec-80bd-69703754a901",
"name": "الرسائل الكونية"
},
{
"id": "0e88e000-b67b-11ec-857f-4779cc02f175",
"name": "شفرة كاليوبـي"
},
{
"id": "4b12a910-8dc4-11ee-834e-e9639325d547",
"name": "الكبرياء"
},
{
"id": "6a9a3cd0-6f1c-11ed-b3bb-b7db1a5a5fb4",
"name": "اليأس"
},
{
"id": "19ea7880-b67b-11ec-b223-b3816b83703a",
"name": "عمر الروح"
},
{
"id": "ef987f80-2ea9-11ee-a25d-4feef67b585b",
"name": "الغراب الاسود"
},
{
"id": "0f35b180-b67b-11ec-913b-27291b8dcad2",
"name": "قانون المسؤولية"
},
],
"status_code": 200
}
Create Comment
POST /v1/admin/comments
Create a new comment.
Request Body
| Parameter | Type | Rules |
|---|---|---|
comment | string | Required, minimum 3 characters |
commentable_id | string | Required, UUID |
commentable_type | string | Required, one of: articles, rates, courses, comments, publications, bundles, ebooks |
status | string | Optional, one of: rejected, approved, pending. Defaults to approved |
Example Request
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "4b83cec0-05af-11f0-a0d3-61f92181933b",
"comment": "ترقبوا مهند الشمي قريبا في سلوانا ترقبوا مهند الشمي قريبا في سلوانا ترقبوا مهند الشمي قريبا في سلوان\nترقبوا مهند الشمي قريبا في سلوانا ترقبوا مهن",
"email": "mazenahmed@bootfi.com",
"name": "omar Alakbri",
"commentable_id": "204d9ae0-7532-11ed-82db-4994ff7b9907",
"status": "approved",
"commentable_type": "App\\Models\\Course",
"writerable_id": "3a0a4810-dab4-11ec-8e1b-cb15cec27c77",
"writerable_type": "App\\Models\\User",
"subject": "أهداف 2023",
"created_at": "2025-03-20 20:18:09",
"updated_at": "2025-03-20 20:18:09",
"reply": null
},
"status_code": 200
}
Response
{
"success": true,
"message": "Data created successfully",
"data": {
"id": "uuid",
"comment": "Great content!",
"status": "approved",
"commentable_id": "uuid",
"commentable_type": "App\\Models\\Course"
}
}
Get Comment
GET /v1/admin/comments/{id}
Retrieve a specific comment by ID.
Response
{
"success": true,
"message": "Data retrieved successfully",
"data": {
"id": "uuid",
"comment": "Comment text",
"status": "approved",
"commentable_id": "uuid",
"commentable_type": "App\\Models\\Course"
}
}
Update Comments
PATCH /v1/admin/comments
Update one or multiple comments.
Request Body
| Parameter | Type | Rules |
|---|---|---|
ids | array | Required, array of UUIDs |
comment | string | Optional, minimum 3 characters |
commentable_id | string | Optional, UUID |
commentable_type | string | Optional, one of: articles, rates, courses, comments, publications, bundles, ebooks |
status | string | Optional, one of: rejected, approved, pending |
restore | boolean | Optional, restore soft-deleted comments |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": [
{
"id": "6e6fdad0-c370-11ef-8e15-79f205f11034",
"comment": "القرارات السهلة لأنني لا أعيرها انتباها فإنه من الممكن أن لا اكون حاسمة فيها أو ان أدع شخص ما يختار لي و هذا عن طيب خاطر و برغبتي أما القرارات المصيرية فأقرر بنفسي بعد صلاة الاستخارةالقرارات السهلة لأنني لا أعير",
"email": "omers@test.com",
"name": "omer khaled",
"commentable_id": "49ee6550-b301-11ef-ae03-a9dd7a389053",
"status": "rejected",
"commentable_type": "App\\Models\\Bundle",
"writerable_id": "95188090-9f4b-11ef-b28e-71ceccea2f0d",
"writerable_type": "App\\Models\\Customer",
"subject": "الباقه الجديدة",
"created_at": "2024-12-26 13:01:52",
"updated_at": "2025-03-23 16:02:46",
"reply": null
}
],
"status_code": 200
}
Delete Comments
DELETE /v1/admin/comments
Soft delete or permanently delete one or multiple comments.
Request Body
| Parameter | Type | Rules |
|---|---|---|
ids | array | Required, array of UUIDs |
confirm_deletion | boolean | Optional, if true performs permanent deletion |
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Authorization
All comment endpoints require admin authorization. The user must have the appropriate permissions to perform these operations.