Add notification preferences and admin governance
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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::table('notification_preferences', function (Blueprint $table) {
|
||||
$table->boolean('in_app_enabled')->default(true)->after('dispute_updates');
|
||||
$table->json('event_preferences')->nullable()->after('push_enabled');
|
||||
$table->string('digest_frequency')->default('immediate')->after('event_preferences');
|
||||
$table->time('quiet_hours_start')->nullable()->after('digest_frequency');
|
||||
$table->time('quiet_hours_end')->nullable()->after('quiet_hours_start');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('notification_preferences', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'in_app_enabled',
|
||||
'event_preferences',
|
||||
'digest_frequency',
|
||||
'quiet_hours_start',
|
||||
'quiet_hours_end',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('audit_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('actor_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('action');
|
||||
$table->nullableMorphs('auditable');
|
||||
$table->json('metadata')->nullable();
|
||||
$table->string('ip_address')->nullable();
|
||||
$table->string('user_agent', 500)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['action', 'created_at']);
|
||||
$table->index(['actor_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('audit_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('moderation_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('reporter_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->morphs('reportable');
|
||||
$table->string('reason_code')->default('other');
|
||||
$table->text('details');
|
||||
$table->string('status')->default('open');
|
||||
$table->foreignId('moderated_by_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('moderated_at')->nullable();
|
||||
$table->text('moderation_notes')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['status', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('moderation_reports');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user