comment moderation improvments

This commit is contained in:
Doar Mihai
2026-02-21 15:50:32 +02:00
parent b936a14a1f
commit 898bddf614
7 changed files with 755 additions and 0 deletions
@@ -0,0 +1,34 @@
<?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::table('comments', function (Blueprint $table) {
$table->string('status')->default('pending')->after('body'); // pending, approved, rejected
$table->foreignId('moderated_by')->nullable()->after('status')->constrained('users')->nullOnDelete();
$table->timestamp('moderated_at')->nullable()->after('moderated_by');
$table->text('moderation_note')->nullable()->after('moderated_at');
$table->index('status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('comments', function (Blueprint $table) {
$table->dropForeign(['moderated_by']);
$table->dropColumn(['status', 'moderated_by', 'moderated_at', 'moderation_note']);
});
}
};