Login History
This section covers the API endpoints for managing login history records in the admin panel.
List Login History
GET /v1/admin/login-histories
Returns a paginated list of login history records.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
search_text | string | Search in IP address, MAC address, username, full name, or email |
filter[country_name] | string | Filter by country name |
filter[device] | string | Filter by device type |
filter[customer_id] | string | Filter by customer UUID |
filter[operating_system] | string | Filter by operating system |
filter[sign_in_date] | string | Filter by sign in date range |
sort | string | Sort by customer_name (prefix with - for descending order) |
per_page | integer | Number of items per page. Defaults to 10 |
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://192.168.0.139:8080/v1/admin/login-histories?page=1",
"from": 1,
"last_page": 2,
"last_page_url": "http://192.168.0.139:8080/v1/admin/login-histories?page=2",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/login-histories?page=1",
"label": "1",
"active": true
},
{
"url": "http://192.168.0.139:8080/v1/admin/login-histories?page=2",
"label": "2",
"active": false
},
{
"url": "http://192.168.0.139:8080/v1/admin/login-histories?page=2",
"label": "التالي »",
"active": false
}
],
"next_page_url": "http://192.168.0.139:8080/v1/admin/login-histories?page=2",
"path": "http://192.168.0.139:8080/v1/admin/login-histories",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 13,
"login_history": [
{
"id": "5c71c190-0571-11f0-bc46-1fc1b2c797ed",
"customer_name": "أسماء عبدالخالق",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"ip_address": "127.0.0.1",
"mac_address": "غير معروف",
"country_name": "غير معروف",
"sign_in_date": "2025-03-20 12:54:48",
"city": "غير معروفه",
"browser": "-",
"device": "unknown-",
"operating_system": "-",
"custom_browser": "-",
"custom_device": "unknown-",
"custom_operating_system": "-",
"browser_version": " ",
"device_version": " ",
"operating_system_version": " ",
"customer_id": "6a8756d0-84ef-11ed-aef6-c38f0c99023c"
},
{
"id": "b93018a0-055f-11f0-9468-7785f0105c02",
"customer_name": "Hamad Alshabanah",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"ip_address": "127.0.0.1",
"mac_address": "غير معروف",
"country_name": "غير معروف",
"sign_in_date": "2025-03-20 10:48:33",
"city": "غير معروفه",
"browser": "-",
"device": "unknown-",
"operating_system": "-",
"custom_browser": "-",
"custom_device": "unknown-",
"custom_operating_system": "-",
"browser_version": " ",
"device_version": " ",
"operating_system_version": " ",
"customer_id": "9f2ecd22-5c07-48ec-9415-2979deec4493"
},
{
"id": "a419d720-047c-11f0-bd70-3d9666f01c31",
"customer_name": "اسم العميل",
"customer_avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"ip_address": "127.0.0.1",
"mac_address": "غير معروف",
"country_name": "غير معروف",
"sign_in_date": "2025-03-19 07:43:02",
"city": "غير معروفه",
"browser": "-",
"device": "unknown-",
"operating_system": "-",
"custom_browser": "-",
"custom_device": "unknown-",
"custom_operating_system": "-",
"browser_version": " ",
"device_version": " ",
"operating_system_version": " ",
"customer_id": "df5323f6-3891-4337-978a-94ef244c82c5"
},
]
},
"status_code": 200
}
Get Login History Statistics
GET /v1/admin/statistics/login-histories
Returns statistics about login history records.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"login_history_for_customers": "13",
"total_customers_login_this_week": [
{
"name": "اسم العميل",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"percentage": "3"
},
{
"name": "Hamad Alshabanah",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"percentage": "1"
},
{
"name": "أسماء عبدالخالق",
"avatar": "https://i.ibb.co/YhTw0wR/7-512.png",
"percentage": "1"
}
],
"customers_countries": [
[
"السعودية",
"120.2%"
],
[
"العراق",
"8.6%"
],
[
"الإمارات",
"7.7%"
],
[
"الجزائر",
"6%"
]
]
},
"status_code": 200
}
Delete Login History Records
PATCH /v1/admin/login-histories
Deletes multiple login history records by their IDs.
Request Body
| Parameter | Type | Description | Validation Rules |
|---|---|---|---|
ids | array | Array of login history IDs to delete | Required |
ids.* | string | Login history UUID | Required, UUID format |
Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Get Available Countries
GET /v1/admin/login-histories/countries
Returns a list of unique country names from login history records.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"countries": [
"غير معروف"
]
},
"status_code": 200
}
Get Available Devices
GET /v1/admin/login-histories/devices
Returns a list of unique device types from login history records.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"devices": [
"unknown-"
]
},
"status_code": 200
}
Get Available Operating Systems
GET /v1/admin/login-histories/operating-systems
Returns a list of unique operating systems from login history records.
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"operating_system": [
"-"
]
},
"status_code": 200
}
Notes
- The list endpoint supports filtering by various parameters including country, device type, and sign-in date
- Results are sorted by creation date in descending order by default
- Statistics include total login count and weekly login activity per customer
- Country statistics show the distribution of customers across different countries
- All delete operations are soft deletes that preserve the record history