TenantAtlas/database/factories/AlertDestinationFactory.php
ahmido 3ed275cef3 feat(alerts): Monitoring cluster + v1 resources (spec 099) (#121)
Implements spec `099-alerts-v1-teams-email`.

- Monitoring navigation: Alerts as a cluster under Monitoring; default landing is Alert deliveries.
- Tenant panel: Alerts points to `/admin/alerts` and the cluster navigation is hidden in tenant panel.
- Guard compliance: removes direct `Gate::` usage from Alert resources so `NoAdHocFilamentAuthPatternsTest` passes.

Verification:
- Full suite: `1348 passed, 7 skipped` (EXIT=0).

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #121
2026-02-18 15:20:43 +00: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(),
],
],
]);
}
}