<?php
namespace Database\Factories;
use App\Modules\Support\Models\SupportTicket;
use App\Modules\Support\Models\TicketMessage;
use App\Modules\User\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class TicketMessageFactory extends Factory
{
protected $model = TicketMessage::class;
public function definition(): array
{
return [
'ticket_id' => SupportTicket::factory(),
'user_id' => User::factory(),
'body' => fake()->paragraph(),
'attachments' => [],
'is_staff_reply' => false,
'is_internal_note'=> false,
'read_at' => null,
];
}
public function staffReply(): static
{
return $this->state(['is_staff_reply' => true]);
}
public function internalNote(): static
{
return $this->state([
'is_staff_reply' => true,
'is_internal_note' => true,
]);
}
public function read(): static
{
return $this->state(['read_at' => now()->subMinutes(5)]);
}
}