Files
KanbanGit/database/factories/NotificationActionFactory.php
T
Twyco 1291a0fcad
CI/CD / preconditions (pull_request) Successful in 4s
CI/CD / test_and_check_app (pull_request) Failing after 2m14s
CI/CD / Publish immutable image (pull_request) Skipped
fix(KAN-14): preserve template inheritance and project data
2026-10-15 11:38:17 +02:00

62 lines
1.8 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\NotificationChannel;
use App\Enums\NotificationEventType;
use App\Models\NotificationAction;
use App\Models\Project;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<NotificationAction>
*/
class NotificationActionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'configuration_key' => (string) Str::uuid(),
'channel' => NotificationChannel::Webhook,
'channel_configuration' => [],
'delivery_url' => 'https://hooks.'.fake()->domainName().'/kanbangit/'.fake()->uuid(),
'enabled' => true,
'event_type' => NotificationEventType::TicketStatusChanged,
'filters' => [],
'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,
]);
}
}