feat: implementasi log riwayat aktivitas super admin dengan tampilan ramah non-it

This commit is contained in:
Ray1111-aa
2026-10-17 09:28:35 +07:00
parent 034da013d3
commit d216322ac6
11 changed files with 1201 additions and 1 deletions
@@ -0,0 +1,42 @@
<?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('admin_activity_logs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->string('user_name')->nullable();
$table->string('user_username')->nullable();
$table->string('action_type', 30)->index(); // 'create', 'update', 'delete', 'permission'
$table->string('module', 50)->index(); // 'Manajemen Pengguna', 'Role & Permission'
$table->string('target_type', 50)->nullable();
$table->unsignedBigInteger('target_id')->nullable();
$table->string('target_name')->nullable();
$table->text('description');
$table->json('old_values')->nullable();
$table->json('new_values')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->timestamps();
$table->index(['created_at', 'action_type']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('admin_activity_logs');
}
};