This commit is contained in:
Dr Masroor Ehsan 2025-01-21 13:49:32 +06:00
parent b2d8739527
commit c9e87ef1bb
3 changed files with 44 additions and 5 deletions

View File

@ -37,7 +37,7 @@ public function popup()
$logs = DB::table('audit_logs') $logs = DB::table('audit_logs')
->leftjoin('users', 'users.id', '=', 'audit_logs.user_id') ->leftjoin('users', 'users.id', '=', 'audit_logs.user_id')
->selectRaw('users.display_name as user_name, audit_logs.*') ->selectRaw('users.display_name as user_name, audit_logs.*')
->orderBy('audit_logs.id') ->orderByDesc('audit_logs.id')
->where('audit_logs.study_id', $study->id) ->where('audit_logs.study_id', $study->id)
->get(); ->get();

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations
*/
public function up(): void
{
Schema::create('user_agents', function (Blueprint $table) {
$table->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');
}
};

View File

@ -1,14 +1,20 @@
<table class="table table-sm"> <table class="table table-sm table-bordered table-responsive">
@foreach ($logs as $log) @foreach ($logs as $log)
<tr> <tr>
<td class="bg-gray-100">{{ $log->created_at }}</td> <td>{{ $log->created_at }}</td>
<td>{{ $log->user_name }}</td> <td>{{ $log->user_name }}</td>
<td>{{ $log->category_name }}</td> <td>{{ $log->category_name }}</td>
<td>{{ $log->activity_name }}</td> <td>{{ $log->activity_name }}</td>
<td>{{ $log->ip_addr }}</td> <td>{{ $log->ip_addr }}</td>
<td>{{ Illuminate\Support\Str::limit($log->user_agent, 20) }}</td>
<td>{{ $log->notes }}</td> <td>{{ $log->notes }}</td>
<td>{{ $log->url }}</td> <td>
@include('_partials._img-tooltip', ['src' => asset('imgs/browser_64.png'), 'tip' => $log->user_agent, 'class' => 'msg-icon'])
</td>
<td>
@isset($log->url)
@include('_partials._img-tooltip', ['src' => asset('imgs/url_64.png'), 'tip' => $log->url, 'class' => 'msg-icon'])
@endisset
</td>
</tr> </tr>
@endforeach @endforeach
</table> </table>