Implement superadmin audit log for mutations
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?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('super_admin_action_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('actor_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('action', 120);
|
||||
$table->nullableMorphs('subject');
|
||||
$table->string('source', 200)->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamp('occurred_at')->useCurrent();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['action', 'occurred_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('super_admin_action_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user