TenantAtlas/database/factories/AlertDestinationFactory.php
2026-02-18 15:25:14 +01:00

41 lines
995 B
PHP

<?php
namespace Database\Factories;
use App\Models\AlertDestination;
use App\Models\Workspace;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<AlertDestination>
*/
class AlertDestinationFactory extends Factory
{
protected $model = AlertDestination::class;
public function definition(): array
{
return [
'workspace_id' => Workspace::factory(),
'name' => 'Destination '.fake()->unique()->word(),
'type' => AlertDestination::TYPE_TEAMS_WEBHOOK,
'is_enabled' => true,
'config' => [
'webhook_url' => 'https://example.invalid/'.fake()->uuid(),
],
];
}
public function email(): static
{
return $this->state(fn (): array => [
'type' => AlertDestination::TYPE_EMAIL,
'config' => [
'recipients' => [
fake()->safeEmail(),
],
],
]);
}
}