Banner
This section covers the API endpoints for managing banners in the admin panel.
List Banners
GET /v1/admin/banners
Returns a paginated list of all banners.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
search_text | string | Search banners by name |
per_page | integer | Number of items per page. Defaults to 10 |
Response
{
"success": true,
"message": "OK",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/banners?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://192.168.0.139:8080/v1/admin/banners?page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/banners?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://192.168.0.139:8080/v1/admin/banners",
"per_page": 10,
"prev_page_url": null,
"to": 4,
"total": 4,
"banners": [
{
"id": "204bfe40-0ffe-11ee-9bc4-2730b18da1bf",
"name": "عيد الاضحى",
"banner_image": "http://192.168.0.139:8080/storage/14285/بانر-عيد-الأضحى-معدل.png",
"alt_text": null,
"is_bg_image": false
},
{
"id": "1d1e59e0-2bfe-11ef-b69c-4da387e787d4",
"name": "عيد الاضحى 2024",
"banner_image": "http://192.168.0.139:8080/storage/23476/بانر-العيد-للموقع2.jpg",
"alt_text": null,
"is_bg_image": false
},
{
"id": "73eac630-e44e-11ef-9634-9f480c6d0f85",
"name": "banner 1ww",
"banner_image": "",
"alt_text": null,
"is_bg_image": false
},
{
"id": "0f28fcb0-e44f-11ef-bb6e-6d98e45fcd5f",
"name": "banner 1ww",
"banner_image": "/storage/28990/360_F_421755953_LitQ8sAhxJ88bFPVjYTjKI3FBhGqrEP2.jpg",
"alt_text": "wow,nice,picture,bro",
"is_bg_image": false
}
]
},
"status_code": 200
}
Create Banner
POST /v1/admin/banners
Create a new banner.
Request Body
| Parameter | Type | Description |
|---|---|---|
name | string | Required. Banner name (3-255 characters) |
banner_image | file | Required. Image file (jpeg, png, jpg). Max size: 1024KB. Dimensions: max width 6000px, max height 1000px |
alt_text | string | Required. Alternative text for the image (3-255 characters) |
Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"name": "banner 1ww",
"banner_image": "/storage/29010/images.jpg",
"alt_text": "wow,nice,picture,bro",
"is_bg_image": false
},
"status_code": 200
}
Get Banner
GET /v1/admin/banners/{id}
Retrieve details of a specific banner.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"name": "Belgium Brussels",
"banner_image": "/storage/29010/images.jpg",
"alt_text": "wow,nice,picture,bro",
"is_bg_image": true
},
"status_code": 200
}
Update Banner
PATCH /v1/admin/banners/{id}
Update an existing banner.
Request Body
| Parameter | Type | Description |
|---|---|---|
name | string | Optional. Banner name (3-255 characters) |
banner_image | file | Optional. Image file (jpeg, png, jpg). Max size: 1024KB. Dimensions: max width 6000px, max height 1000px |
is_bg_image | boolean | Optional. Set as main active banner |
alt_text | string | Optional. Alternative text for the image (3-255 characters) |
Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "2f480800-0591-11f0-b80f-f1005a85de27",
"name": "Belgium Brussels",
"banner_image": "/storage/29010/images.jpg",
"alt_text": "wow,nice,picture,bro",
"is_bg_image": true
},
"status_code": 200
}
Delete Banner
DELETE /v1/admin/banners/{id}
Delete a specific banner.
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Authorization
All banner endpoints require admin authorization. The user must have the appropriate permissions to perform these operations.
Notes
- Only one banner can be set as main active banner (
is_bg_image = true) - When updating a banner as main active banner, any other banner with
is_bg_image = truewill be automatically set tofalse - Banner images must meet the specified dimension requirements
- Supported image formats: JPEG, PNG, JPG
- Maximum image file size: 1024KB