*/ class NotificationActionFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'channel' => NotificationChannel::Webhook, 'channel_configuration' => [], 'delivery_url' => 'https://hooks.'.fake()->domainName().'/kanbangit/'.fake()->uuid(), 'enabled' => true, 'event_type' => NotificationEventType::TicketStatusChanged, 'message_template' => null, 'name' => fake()->unique()->sentence(3), 'project_id' => Project::factory(), ]; } public function discord(): static { return $this->state(fn (): array => [ 'channel' => NotificationChannel::Discord, 'delivery_url' => 'https://discord.com/api/webhooks/'.fake()->numberBetween(100_000, 999_999).'/'.fake()->uuid(), 'message_template' => '$ticket_key moved from $status_from to $status_to by $actor_name: $url', ]); } public function disabled(): static { return $this->state(fn (): array => [ 'enabled' => false, ]); } public function webhook(): static { return $this->state(fn (): array => [ 'channel' => NotificationChannel::Webhook, 'message_template' => null, ]); } }