44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\GuestNotificationDeliveryStatus;
|
|
use App\Models\GuestNotification;
|
|
use App\Models\GuestNotificationReceipt;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<GuestNotificationReceipt>
|
|
*/
|
|
class GuestNotificationReceiptFactory extends Factory
|
|
{
|
|
protected $model = GuestNotificationReceipt::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'guest_notification_id' => GuestNotification::factory(),
|
|
'guest_identifier' => $this->faker->unique()->userName(),
|
|
'status' => GuestNotificationDeliveryStatus::NEW,
|
|
'read_at' => null,
|
|
'dismissed_at' => null,
|
|
];
|
|
}
|
|
|
|
public function read(): self
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => GuestNotificationDeliveryStatus::READ,
|
|
'read_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function dismissed(): self
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => GuestNotificationDeliveryStatus::DISMISSED,
|
|
'dismissed_at' => now(),
|
|
]);
|
|
}
|
|
}
|