Files
muninn/database/factories/TaskCommentFactory.php
m105andClaude Sonnet 5 a4ff6c0ccb Commit the Projects/Tasks/Ideas/TaskComments feature
This was already implemented, migrated, and running live, but had
never been committed. Bringing it into git: Project/Task/Idea/
TaskComment models, their JSON API (CRUD + status transitions,
task comments, idea<->project linking), Livewire UI pages, and the
nav/route wiring for them. All 42 of its own tests pass.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-06 20:41:57 +03:00

54 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Task;
use App\Models\TaskComment;
use Illuminate\Database\Eloquent\Factories\Factory;
class TaskCommentFactory extends Factory
{
protected $model = TaskComment::class;
public function definition(): array
{
return [
'task_id' => Task::factory(),
'body' => fake()->paragraph(),
'author_type' => fake()->randomElement(TaskComment::AUTHOR_TYPES),
'author_name' => fake()->name(),
];
}
public function fromUser(): static
{
return $this->state(fn () => [
'author_type' => 'user',
'author_name' => fake()->name(),
]);
}
public function fromAI(): static
{
return $this->state(fn () => [
'author_type' => 'ai',
'author_name' => fake()->randomElement(['AI Assistant', 'ChatBot', 'Virtual Helper']),
]);
}
public function fromSystem(): static
{
return $this->state(fn () => [
'author_type' => 'system',
'author_name' => fake()->randomElement(['System', 'Automation', 'Scheduler']),
]);
}
public function forTask(Task $task): static
{
return $this->state(fn () => [
'task_id' => $task->id,
]);
}
}