|
|
|
@ -23,15 +23,22 @@ class OperationLogExport implements FromArray, WithHeadings |
|
|
|
'created_at' |
|
|
|
]; |
|
|
|
$actionArr = AdminOperationLog::getActionArr(); |
|
|
|
AdminOperationLog::all($columns)->each( |
|
|
|
AdminOperationLog::query()->orderBy('created_at', 'desc')->select( |
|
|
|
$columns |
|
|
|
)->take(1)->each( |
|
|
|
function ($item) use (&$data, &$index, $actionArr) { |
|
|
|
$username = AdminUsers::getUsername($item['user_id']); |
|
|
|
$item['operation_name'] = $username ?? ''; |
|
|
|
$item['action_str'] = $actionArr[$item['action']] ?? |
|
|
|
$item['action']; |
|
|
|
$description = __('log.' . $item['description']); |
|
|
|
if (strpos($description, 'log.') === false) { |
|
|
|
$item['description'] = $description; |
|
|
|
if ($item['user_id']) { |
|
|
|
$username = AdminUsers::getUsername($item['user_id']); |
|
|
|
$item['operation_name'] = $username ?? ''; |
|
|
|
} |
|
|
|
if (isset($actionArr[$item['action']])) { |
|
|
|
$item['action_str'] = $actionArr[$item['action']]; |
|
|
|
} |
|
|
|
if ($item['description']) { |
|
|
|
$description = __('log.' . $item['description']); |
|
|
|
if (strpos($description, 'log.') === false) { |
|
|
|
$item['description'] = $description; |
|
|
|
} |
|
|
|
} |
|
|
|
$item['main_directory'] = ''; |
|
|
|
if ($item['sub_directory']) { |
|
|
|
@ -47,13 +54,13 @@ class OperationLogExport implements FromArray, WithHeadings |
|
|
|
} |
|
|
|
$data[] = [ |
|
|
|
'id' => $index, |
|
|
|
'created_at' => $item['created_at'], |
|
|
|
'operation_name' => $item['operation_name'], |
|
|
|
'main_directory' => $item['main_directory'], |
|
|
|
'sub_directory' => $item['sub_directory'], |
|
|
|
'action' => $item['action'], |
|
|
|
'action_str' => $item['action_str'], |
|
|
|
'description' => $item['description'], |
|
|
|
'created_at' => $item['created_at'] ?? '', |
|
|
|
'operation_name' => $item['operation_name'] ?? '', |
|
|
|
'main_directory' => $item['main_directory'] ?? '', |
|
|
|
'sub_directory' => $item['sub_directory'] ?? '', |
|
|
|
'action' => $item['action'] ?? '', |
|
|
|
'action_str' => $item['action_str'] ?? '', |
|
|
|
'description' => $item['description'] ?? '', |
|
|
|
]; |
|
|
|
$index += 1; |
|
|
|
} |
|
|
|
|