Articles
This section covers the API endpoints for managing articles in the admin panel.
List Articles
GET /v1/admin/articles
Returns a list of articles with pagination support.
Query Parameters
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
search_text | string | Search in article titles | Optional |
list | boolean | If true, returns a simple list of all articles | Optional |
per_page | integer | Number of items per page | Optional, default: 10 |
filter[active] | boolean | Filter by article active status | Optional |
filter[can_comment] | boolean | Filter by comment permission status | Optional |
filter[trashed] | boolean | Filter trashed articles | Optional |
sort | string | Sort by field (prefix with - for desc) | Optional, allowed: title, active, comments_count |
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/articles?page=1",
"from": 1,
"last_page": 23,
"last_page_url": "http://192.168.0.139:8080/v1/admin/articles?page=23",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/articles?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "...",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/articles?page=22",
"label": "22",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/articles?page=23",
"label": "23",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/articles?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://192.168.0.139:8080/v1/admin/articles?page=2",
"path": "http://192.168.0.139:8080/v1/admin/articles",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 225,
"articles": [
{
"id": "377d34a0-3f25-11ee-8738-c909ac5b1bc4",
"title": "اللعبة 🎮",
"poster": "http://192.168.0.139:8080/storage/16355/صورة2.png",
"active": true,
"comments_count": 143,
"views_count": 13170,
"can_comment": true,
"user_id": null
},
{
"id": "2a86bfe0-3f24-11ee-8cc9-eb1b27f95d9c",
"title": "ماهو توقيت متعتك؟",
"poster": "http://192.168.0.139:8080/storage/16354/pleasure-time.png",
"active": true,
"comments_count": 127,
"views_count": 10620,
"can_comment": true,
"user_id": null
},
{
"id": "f083c6c0-3c08-11ee-a0f5-3325cca2539b",
"title": "مستمتع؟",
"poster": "http://192.168.0.139:8080/storage/16263/joyfull.png",
"active": true,
"comments_count": 47,
"views_count": 4051,
"can_comment": true,
"user_id": null
},
{
"id": "716852d0-2b84-11ee-b5cf-e38674657e7c",
"title": "خلافات زوجية",
"poster": "http://192.168.0.139:8080/storage/15509/صورة14.png",
"active": true,
"comments_count": 16,
"views_count": 1855,
"can_comment": true,
"user_id": null
},
]
},
"status_code": 200
}
Get Article Statistics
GET /v1/admin/statistics/articles
Returns statistics about articles including total views and most viewed/commented articles.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"total_views": "76.58k",
"most_viewed_article": {
"title": "قصة الشعور",
"poster": "http://192.168.0.139:8080/storage/14922/hn2.png",
"views": 1263
},
"most_commented_article": {
"title": "اللعبة 🎮",
"poster": "http://192.168.0.139:8080/storage/16355/صورة2.png",
"comments_count": "143"
},
"most_viewed_articles": [
{
"title": "قصة الشعور",
"views": 771
},
{
"title": "نهاية النجاح",
"views": "1.33k"
},
{
"title": "هل انت غاضب من صدمة تعرضت لها؟",
"views": "2.76k"
},
{
"title": "من هم الأشخاص الذين يدمرون أنفسهم؟",
"views": "2.61k"
}
]
},
"status_code": 200
}
Create Article
POST /v1/admin/articles
Creates a new article.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
title | string | Article title | Required, min: 3, max: 255 |
body | string | Article content | Required, min: 3 |
poster | file | Article poster image | Required, mime: jpeg,png,jpg, max: 1024KB |
active | boolean | Article active status | Required, values: true/false |
can_comment | boolean | Allow comments on article | Required, values: true/false |
category_ids | array | Array of category UUIDs | Optional |
category_ids.* | string | Category UUID | Required if category_ids provided, UUID format, must exist |
tag_names | array | Array of tag names | Optional |
tag_names.* | string | Tag name | min: 3, max: 255 |
Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "52c62260-058d-11f0-aa22-ab24a5d42521",
"title": "الدكتور",
"body": "ذلك ونحن نجد أن ما كان قد تعلمها من الحيوانات، ويجر يده على رأسه، ويمسح أعطافه. ويتملق إليه، ويظهر البشر والفرح به. حتى سكن جأش أسال وعلم أنه لا.",
"poster": "/storage/29005/Screenshot-from-2025-02-24-13-39-01.png",
"can_comment": false,
"active": true,
"comments_count": 0,
"views_count": null,
"tag_names": [
"dsرﻻؤ",
"dsfsdfdfs"
],
"categories": [],
"tags": [
{
"id": "52cdff00-058d-11f0-9327-d1647a13ad72",
"name": "dsرﻻؤ",
"color": "#98DEDE",
"pivot": {
"taggable_type": "App\\Models\\Article",
"taggable_id": "52c62260-058d-11f0-aa22-ab24a5d42521",
"tag_id": "52cdff00-058d-11f0-9327-d1647a13ad72"
},
"created_at": "2025-03-20 16:14:58",
"updated_at": "2025-03-20 16:14:58"
},
{
"id": "52ce89d0-058d-11f0-838e-d1c7b8b5a9f7",
"name": "dsfsdfdfs",
"color": "#98DEDE",
"pivot": {
"taggable_type": "App\\Models\\Article",
"taggable_id": "52c62260-058d-11f0-aa22-ab24a5d42521",
"tag_id": "52ce89d0-058d-11f0-838e-d1c7b8b5a9f7"
},
"created_at": "2025-03-20 16:14:58",
"updated_at": "2025-03-20 16:14:58"
}
]
},
"status_code": 200
}
Get Article Details
GET /v1/admin/articles/{id}
Returns details of a specific article.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "377d34a0-3f25-11ee-8738-c909ac5b1bc4",
"title": "اللعبة 🎮",
"body": "<p><span style=\"color: black;\">يختار بعض الناس عدم اللعب ، ولأن أجسادهم الفكرية متضخمة يعتقدون بأن اللعب سلوك ذو قيمة منخفضة </span></p><p><span style=\"color: black;\"> </span></p><p><span style=\"color: black;\"> ويختار البعض اللعب في لعبة تثير الغضب والقلق والتوتر، وحين يبدأ اللعبة كأنه يضغط الزناد على أسوأ مشاعره السلبية ، ويعيش لساعات طويلة تحت هذا الضغط ؛ ويقول بأنه مستمتع بهذه اللعبة </span></p><p><span style=\"color: black;\"> </span></p><p><span style=\"color: black;\"> ويختار بعض الناس اللعب لأن هذا يساعدهم في تنشيط ابداعهم ، وفي الاتصال مع ذواتهم… بل انهم يتذكرون من هم بوعي أو بلاوعي من خلال هذه اللعبة</span></p><p><span style=\"color: black;\"> </span></p><p><span style=\"color: black;\"> ويختار البعض اللعب بعد يوم طويل ومرهق حتى يشعر بالهدوء والاسترخاء والسلام والاستمتاع </span></p><p><span style=\"color: black;\"> فهو يستخدم اللعبة طوال الوقت كأداة لتطوير جسده المشاعري </span></p><p><span style=\"color: black;\"> </span></p><p><span style=\"color: black;\"> من الغريب جداً أن تعرف بأن بعض الأشخاص يحصلون على شعور جيد في اللعبة لا يحصلون عليه في الحياة الواقعية ؛ وهذا يعني بأنهم يعيشون حياة حقيقية أكثر هناك (في اللعبة) .</span></p><p><br></p><p><br></p><p><span style=\"color: black;\"> </span></p><p><strong style=\"color: black;\"> والسؤال الآن:</strong></p><p><strong style=\"color: black;\"> ماهي لعبتك المفضلة؟ وما هو شعورها؟</strong></p><p class=\"ql-align-right\"><strong style=\"color: black;\"> شاركنا بحب.. </strong></p>",
"poster": "http://192.168.0.139:8080/storage/16355/conversions/صورة2-show.jpg",
"can_comment": true,
"active": true,
"comments_count": 143,
"views_count": null,
"tag_names": [],
"categories": [
"0c2a59f0-ec6e-11ec-8108-6d5b206372c7"
],
"tags": []
},
"status_code": 200
}
Update Article
PATCH /v1/admin/articles/{id}
Updates an existing article.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
title | string | Article title | min: 3, max: 255 |
body | string | Article content | min: 3 |
poster | file | Article poster image | mime: jpeg,png,jpg, max: 1024KB |
active | boolean | Article active status | values: true/false |
can_comment | boolean | Allow comments on article | values: true/false |
category_ids | array | Array of category UUIDs | Optional |
category_ids.* | string | Category UUID | UUID format, must exist |
tag_names | array | Array of tag names | Optional |
tag_names.* | string | Tag name | min: 3, max: 255 |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "ca510df0-c938-11ed-a35e-c72b08493b15",
"title": "قصة الحظ",
"body": "<p><br></p><p>بدأ الحظ حين كانت القصة نظيفة تماما </p><p>حين كان حسن الظن هو أول الاحتمالات وأقواها </p><p>حين كانت البراءة هي الأصل </p><p>حين كان النور هو المنتصر </p><p>حين كان الفساد قصة تأنيب </p><p> </p><p>ثم أصبح الحظ…</p><p>حالة من القبول </p><p>والتغافل بحكمة</p><p>و التركيز على الطريق</p><p><br></p><p>لقد كان النحس ومازال يقاتل ليجد مكانه في اجسادنا</p><p>في لحظة ضعف </p><p>وانكسار</p><p>وبعد صدمة</p><p>وحالة يأس </p><p><br></p><p>وبمجرد أن تعرف معادلة الحظ تستعيد حقك في حياة جيدة .. فقط التزم بإطلاق النية ثم تتبع رسائلك الكونية</p><p><br></p><p>تذكر بأن خيارات الحظ والنحس دائما متاحة لمن يتبعها، وهي دائما حساسة ومتغيرة وفقاً للظروف</p><p>لذا لا تكن قاس ٍ على نفسك</p><p>ولكن اختر | الحظ | دائماً</p><p><br></p><p><strong>والسؤال الآن:</strong></p><p class=\"ql-align-right\"><strong>هل أنت محظوظ؟</strong></p>",
"poster": "http://192.168.0.139:8080/storage/11435/conversions/قصة-الحظ-مقالة-show.jpg",
"can_comment": true,
"active": true,
"comments_count": 11,
"views_count": null,
"tag_names": [],
"categories": [
"ad578de0-b2a0-11ed-8930-b5dae55dbf5e"
],
"tags": []
},
"status_code": 200
}
Delete Articles
DELETE /v1/admin/articles
Deletes multiple articles by their IDs.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
ids | array | Array of article IDs to delete | Required |
ids.* | string | Article UUID | Required, UUID format |
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Notes
- The list endpoint supports pagination and advanced filtering
- Results are sorted by creation date in descending order by default
- When updating categories, sending an empty array will remove all categories
- Media files (posters) are automatically handled and stored in the appropriate collection
- Tags are created automatically if they don't exist
- The statistics endpoint provides random data for total views