Add post comments with moderation plus view/like interaction endpoints
Deploy Backend / deploy (push) Successful in 2m41s

- blog_comments table + Comment model/factory; comments attach to the post,
  public list shows approved rows only, public submission starts unapproved
- Admin moderation API: list/filter, approve, delete comments
- Public POST posts/{slug}/view and posts/{slug}/like toggle counters
- Route groups: comments throttled like the contact form, interactions at
  60/min; comments resource exposed to the generic admin list
This commit is contained in:
Parsa Aghayi committed 2026-10-02 11:06:06 -04:00
1 parent fbacb0c9a1
commit e98807da05
11 files changed
+497

No files matched your search

@@ -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::create('blog_comments', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('post_id');
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
$table->string('name', 120);
$table->string('email', 255)->nullable();
$table->text('body');
$table->boolean('is_approved')->default(false);
$table->timestamps();
$table->index('post_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_comments');
}
};