2025_12_15_084451_create_comments_table.php 804 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. return new class extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. */
  10. public function up(): void
  11. {
  12. Schema::create('comments', function (Blueprint $table) {
  13. $table->id();
  14. $table->text('content')->nullable();
  15. $table->morphs('commentable');
  16. $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
  17. $table->boolean('is_banned')->default(false);
  18. $table->timestamps();
  19. $table->softDeletes();
  20. });
  21. }
  22. /**
  23. * Reverse the migrations.
  24. */
  25. public function down(): void
  26. {
  27. Schema::dropIfExists('comments');
  28. }
  29. };