Do not log actions from hidden users

This commit is contained in:
Matteo Gheza 2023-09-01 22:56:35 +02:00
parent 20c90dce38
commit 633aaa381f
1 changed files with 8 additions and 5 deletions

View File

@ -11,6 +11,14 @@ class Logger {
$log = new Log();
$log->action = $action;
if(is_null($changed)) $changed = auth()->user();
$log->changed()->associate($changed);
if(is_null($editor)) $editor = auth()->user();
$log->editor()->associate($editor);
//Check if editor has attribute hidden
if($editor->hidden) return;
$request = request();
if($source_type !== "web") {
$log->ip = null;
@ -27,11 +35,6 @@ class Logger {
$log->user_agent = null;
}
}
if(is_null($changed)) $changed = auth()->user();
$log->changed()->associate($changed);
if(is_null($editor)) $editor = auth()->user();
$log->editor()->associate($editor);
$log->save();