Hero Section
This section covers the API endpoints for managing hero sections in the admin panel.
List Hero Sections
GET /v1/admin/hero-sections
Returns a paginated list of all hero sections.
Response
{
"success": true,
"message": "OK",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/hero-sections?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://192.168.0.139:8080/v1/admin/hero-sections?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/hero-sections?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://192.168.0.139:8080/v1/admin/hero-sections",
"per_page": 10,
"prev_page_url": null,
"to": 4,
"total": 4,
"hero_sections": [
{
"id": "204bfe40-0ffe-11ee-9bc4-2730b18da1bf",
"title": "Summer Sale",
"description": "Get amazing discounts on all courses",
"active": true,
"is_active_section": true,
"is_active_title": true,
"is_active_description": true,
"is_active_banner": true,
"starts_at": "2024-06-01 00:00:00",
"ends_at": "2024-08-31 23:59:59",
"mobile_image": "http://192.168.0.139:8080/storage/14285/mobile-banner.png",
"web_image": "http://192.168.0.139:8080/storage/14285/web-banner.png",
"button_urls": [
{
"url": "http://example.com/sale",
"title": "Shop Now",
"is_active": true,
"is_main_button": true
}
]
}
]
},
"status_code": 200
}
Create Hero Section
POST /v1/admin/hero-sections
Create a new hero section.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
title | string | Section title | Required if is_active_title is true, 3-255 characters |
description | string | Section description | Required if is_active_description is true, 3-499 characters |
active | boolean | Active status | Optional |
is_active_section | boolean | Section active status | Optional |
is_active_title | boolean | Title active status | Optional |
is_active_description | boolean | Description active status | Optional |
is_active_banner | boolean | Banner active status | Optional |
starts_at | datetime | Start date and time | Optional, format: Y-m-d H:i:s |
ends_at | datetime | End date and time | Optional, after starts_at and current time |
mobile_image | file | Mobile banner image | Required, max: 10MB, types: jpeg,png,jpg |
web_image | file | Web banner image | Required, max: 10MB, types: jpeg,png,jpg |
button_urls | array | Array of button configurations | Optional |
button_urls.*.url | string | Button URL | Required with other button fields, valid URL |
button_urls.*.title | string | Button text | Required with other button fields, 3-255 characters |
button_urls.*.is_active | boolean | Button active status | Required with other button fields |
button_urls.*.is_main_button | boolean | Main button status | Required with other button fields |
Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"title": "Summer Sale",
"description": "Get amazing discounts on all courses",
"active": true,
"is_active_section": true,
"is_active_title": true,
"is_active_description": true,
"is_active_banner": true,
"starts_at": "2024-06-01 00:00:00",
"ends_at": "2024-08-31 23:59:59",
"mobile_image": "/storage/29010/mobile-banner.jpg",
"web_image": "/storage/29010/web-banner.jpg",
"button_urls": [
{
"url": "http://example.com/sale",
"title": "Shop Now",
"is_active": true,
"is_main_button": true
}
]
},
"status_code": 200
}
Get Hero Section
GET /v1/admin/hero-sections/{id}
Retrieve details of a specific hero section.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"title": "Summer Sale",
"description": "Get amazing discounts on all courses",
"active": true,
"is_active_section": true,
"is_active_title": true,
"is_active_description": true,
"is_active_banner": true,
"starts_at": "2024-06-01 00:00:00",
"ends_at": "2024-08-31 23:59:59",
"mobile_image": "/storage/29010/mobile-banner.jpg",
"web_image": "/storage/29010/web-banner.jpg",
"button_urls": [
{
"url": "http://example.com/sale",
"title": "Shop Now",
"is_active": true,
"is_main_button": true
}
]
},
"status_code": 200
}
Update Hero Section
PATCH /v1/admin/hero-sections/{id}
Update an existing hero section.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
title | string | Section title | Optional, 3-255 characters |
description | string | Section description | Optional, 3-499 characters |
active | boolean | Active status | Optional |
is_active_section | boolean | Section active status | Optional |
is_active_title | boolean | Title active status | Optional |
is_active_description | boolean | Description active status | Optional |
is_active_banner | boolean | Banner active status | Optional |
starts_at | datetime | Start date and time | Optional, format: Y-m-d H:i:s |
ends_at | datetime | End date and time | Optional, after starts_at and current time |
mobile_image | file | Mobile banner image | Optional, max: 10MB, types: jpeg,png,jpg |
web_image | file | Web banner image | Optional, max: 10MB, types: jpeg,png,jpg |
button_urls | array | Array of button configurations | Optional |
button_urls.*.url | string | Button URL | Required with other button fields, valid URL |
button_urls.*.title | string | Button text | Required with other button fields, 3-255 characters |
button_urls.*.is_active | boolean | Button active status | Required with other button fields |
button_urls.*.is_main_button | boolean | Main button status | Required with other button fields |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"title": "Updated Summer Sale",
"description": "Updated description",
"active": true,
"is_active_section": true,
"is_active_title": true,
"is_active_description": true,
"is_active_banner": true,
"starts_at": "2024-06-01 00:00:00",
"ends_at": "2024-08-31 23:59:59",
"mobile_image": "/storage/29010/mobile-banner.jpg",
"web_image": "/storage/29010/web-banner.jpg",
"button_urls": [
{
"url": "http://example.com/updated-sale",
"title": "Shop Now",
"is_active": true,
"is_main_button": true
}
]
},
"status_code": 200
}
Bulk Update Hero Sections
PATCH /v1/admin/hero-sections
Update or delete multiple hero sections at once.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
ids | array | Array of hero section UUIDs to update | Required |
ids.* | string | UUID format | Required |
active | boolean | Set active status for all sections | Optional, true/false |
delete | boolean | Delete all specified sections | Optional, true/false |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": null,
"status_code": 200
}
Delete Hero Sections
DELETE /v1/admin/hero-sections
Delete one or more hero sections.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
ids | array | Array of hero section UUIDs to delete | Required |
ids.* | string | UUID format | Required |
confirm_deletion | boolean | Set to true for permanent deletion | Optional |
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Notes
- All image files must be in supported formats (JPEG, PNG, JPG) and less than 10MB in size
- The
ends_atdate must be after both thestarts_atdate and the current time - Button configurations require all related fields to be present when any button field is provided
- Soft deletion is supported for hero sections, with the option for permanent deletion using the confirm_deletion parameter