feat: implement system-wide activity logging with database persistence, repository patterns, and admin controller access.
This commit is contained in:
@@ -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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('activity_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('log_name', 100)->index();
|
||||
$table->string('event', 30)->index();
|
||||
$table->text('description');
|
||||
$table->string('subject_type', 150)->nullable()->index();
|
||||
$table->string('subject_id', 100)->nullable()->index();
|
||||
$table->string('causer_type', 20)->nullable()->index(); // admin | customer | system
|
||||
$table->unsignedBigInteger('causer_id')->nullable()->index();
|
||||
$table->string('causer_name', 150)->nullable();
|
||||
$table->json('old_values')->nullable();
|
||||
$table->json('new_values')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent()->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('activity_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user