2011-06-03 14:44:01 +02:00
|
|
|
<?php
|
2016-09-29 10:53:17 +02:00
|
|
|
|
2018-08-31 01:55:05 +02:00
|
|
|
use Engelsystem\Models\LogEntry;
|
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function admin_log_title()
|
|
|
|
{
|
2018-08-29 21:55:32 +02:00
|
|
|
return __('Log');
|
2013-11-25 21:04:58 +01:00
|
|
|
}
|
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function admin_log()
|
|
|
|
{
|
2017-01-03 14:12:17 +01:00
|
|
|
$filter = '';
|
2017-07-18 21:38:53 +02:00
|
|
|
if (request()->has('keyword')) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$filter = strip_request_item('keyword');
|
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-08-31 01:55:05 +02:00
|
|
|
$log_entries = LogEntry::filter($filter);
|
|
|
|
|
|
|
|
$entries = [];
|
|
|
|
foreach ($log_entries as $entry) {
|
|
|
|
$data = $entry->toArray();
|
|
|
|
$data['created_at'] = date_format($entry->created_at, 'd.m.Y H:i');
|
|
|
|
$entries[] = $data;
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-02 03:57:23 +01:00
|
|
|
return page_with_title(admin_log_title(), [
|
2017-01-02 15:43:36 +01:00
|
|
|
msg(),
|
|
|
|
form([
|
2018-08-29 21:55:32 +02:00
|
|
|
form_text('keyword', __('Search'), $filter),
|
|
|
|
form_submit(__('Search'), 'Go')
|
2017-01-02 15:43:36 +01:00
|
|
|
]),
|
|
|
|
table([
|
2018-08-31 01:55:05 +02:00
|
|
|
'created_at' => 'Time',
|
|
|
|
'level' => 'Type',
|
|
|
|
'message' => 'Log Entry'
|
|
|
|
], $entries)
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2011-06-03 14:44:01 +02:00
|
|
|
}
|