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
26 lines
626 B
PHP
26 lines
626 B
PHP
<?php
|
|
|
|
namespace Database\Factories\Blog;
|
|
|
|
use App\Models\Blog\Comment;
|
|
use App\Models\Blog\Post;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Blog\Comment>
|
|
*/
|
|
class CommentFactory extends Factory
|
|
{
|
|
protected $model = Comment::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'post_id' => Post::factory(),
|
|
'name' => $this->faker->name(),
|
|
'email' => $this->faker->safeEmail(),
|
|
'body' => $this->faker->paragraph(),
|
|
'is_approved' => false,
|
|
];
|
|
}
|
|
} |