feat: implementasi log riwayat aktivitas super admin dengan tampilan ramah non-it
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user