TenantAtlas/app/Notifications/OperationRunCompleted.php
2026-01-18 15:46:49 +01:00

34 lines
751 B
PHP

<?php
namespace App\Notifications;
use App\Models\OperationRun;
use App\Models\Tenant;
use App\Support\OpsUx\OperationUxPresenter;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class OperationRunCompleted extends Notification
{
use Queueable;
public function __construct(
public OperationRun $run
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function toDatabase(object $notifiable): array
{
$tenant = $this->run->tenant;
return OperationUxPresenter::terminalDatabaseNotification(
run: $this->run,
tenant: $tenant instanceof Tenant ? $tenant : null,
)->getDatabaseMessage();
}
}