Filament comments package with: - Polymorphic commenting on any Eloquent model - Threaded replies with configurable depth - @mentions with autocomplete and user search - Emoji reactions with toggle and who-reacted tooltips - File attachments via Livewire uploads - Reply and mention notifications via Filament notification system - Thread subscriptions for notification control - Real-time broadcasting (opt-in Echo) with polling fallback - Dark mode support - CommentsAction, CommentsTableAction, CommentsEntry for Filament integration - 204 tests, 421 assertions
35 lines
770 B
PHP
35 lines
770 B
PHP
<?php
|
|
|
|
namespace Relaticle\Comments\Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Relaticle\Comments\Comment;
|
|
|
|
class CommentFactory extends Factory
|
|
{
|
|
protected $model = Comment::class;
|
|
|
|
/** @return array<string, mixed> */
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'body' => '<p>'.fake()->paragraph().'</p>',
|
|
'edited_at' => null,
|
|
];
|
|
}
|
|
|
|
public function withParent(?Comment $parent = null): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'parent_id' => $parent?->id,
|
|
]);
|
|
}
|
|
|
|
public function edited(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'edited_at' => now(),
|
|
]);
|
|
}
|
|
}
|