Add filter of user IP

This commit is contained in:
Zero 2021-11-26 13:08:04 +08:00
parent 8dee3d3a83
commit a12e346439

View File

@ -20,6 +20,7 @@ class AuditLogController extends Controller
'date_from' => $request->get('date_from', ''),
'date_to' => $request->get('date_to', ''),
'user' => $request->get('user', ''),
'ip' => $request->get('ip', ''),
];
$query = Activity::query()
@ -44,6 +45,9 @@ class AuditLogController extends Controller
if ($listDetails['date_to']) {
$query->where('created_at', '<=', $listDetails['date_to']);
}
if ($listDetails['ip']) {
$query->where('ip', '=', $listDetails['ip']);
}
$activities = $query->paginate(100);
$activities->appends($listDetails);