Filter data

[MAILPOET-3135]
This commit is contained in:
Pavel Dohnal
2021-03-03 14:02:41 +01:00
committed by Veljko V
parent 8bdcfebee8
commit 4481444282
2 changed files with 21 additions and 4 deletions

View File

@@ -22,9 +22,18 @@ class Logs {
}
public function render() {
$search = isset($_GET['search']) ? $_GET['search'] : null;
$from = isset($_GET['from']) ? $_GET['from'] : null;
$to = isset($_GET['to']) ? $_GET['to'] : null;
$dateFrom = (new Carbon())->subDays(7);
$dateTo = new Carbon();
$logs = $this->logRepository->getLogs($dateFrom, $dateTo);
if (isset($from)) {
$dateFrom = new Carbon($from);
}
$dateTo = null;
if (isset($to)) {
$dateTo = new Carbon($to);
}
$logs = $this->logRepository->getLogs($dateFrom, $dateTo, $search);
$data = ['logs' => []];
foreach ($logs as $log) {
$data['logs'][] = [