*/ class NotificationFactory extends Factory { protected $model = Notification::class; /** * @return array */ public function definition(): array { return [ 'type' => fake()->randomElement(NotificationTypeEnum::cases()), 'severity' => fake()->randomElement(NotificationSeverityEnum::cases()), 'title' => fake()->sentence(3), 'message' => fake()->sentence(), 'data' => null, 'read_at' => null, ]; } public function read(): static { return $this->state(['read_at' => now()]); } public function unread(): static { return $this->state(['read_at' => null]); } public function severity(NotificationSeverityEnum $severity): static { return $this->state(['severity' => $severity]); } public function type(NotificationTypeEnum $type): static { return $this->state(['type' => $type]); } }