diff --git a/app/Http/Controllers/Staff/AuditLogController.php b/app/Http/Controllers/Staff/AuditLogController.php index 8d59403..0fb8428 100644 --- a/app/Http/Controllers/Staff/AuditLogController.php +++ b/app/Http/Controllers/Staff/AuditLogController.php @@ -37,7 +37,7 @@ public function popup() $logs = DB::table('audit_logs') ->leftjoin('users', 'users.id', '=', 'audit_logs.user_id') ->selectRaw('users.display_name as user_name, audit_logs.*') - ->orderBy('audit_logs.id') + ->orderByDesc('audit_logs.id') ->where('audit_logs.study_id', $study->id) ->get(); diff --git a/database/migrations/2024_11_21_821544_create_user_agents_table.php b/database/migrations/2024_11_21_821544_create_user_agents_table.php new file mode 100644 index 0000000..0db547b --- /dev/null +++ b/database/migrations/2024_11_21_821544_create_user_agents_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('user_agent'); + $table->string('browser'); + $table->string('browser_version'); + $table->string('os'); + $table->string('os_version'); + $table->string('device'); + $table->string('device_type'); + $table->string('device_brand'); + $table->string('device_model'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('user_agents'); + } +}; diff --git a/resources/views/staff/audit/popup.blade.php b/resources/views/staff/audit/popup.blade.php index 48d3ae1..149176d 100644 --- a/resources/views/staff/audit/popup.blade.php +++ b/resources/views/staff/audit/popup.blade.php @@ -1,14 +1,20 @@ - +
@foreach ($logs as $log) - + - - + + @endforeach
{{ $log->created_at }}{{ $log->created_at }} {{ $log->user_name }} {{ $log->category_name }} {{ $log->activity_name }} {{ $log->ip_addr }}{{ Illuminate\Support\Str::limit($log->user_agent, 20) }} {{ $log->notes }}{{ $log->url }} + @include('_partials._img-tooltip', ['src' => asset('imgs/browser_64.png'), 'tip' => $log->user_agent, 'class' => 'msg-icon']) + + @isset($log->url) + @include('_partials._img-tooltip', ['src' => asset('imgs/url_64.png'), 'tip' => $log->url, 'class' => 'msg-icon']) + @endisset +