Source path: app/Notifications/GenericAlert.php
Extracted from supplied specification. Review before copying into application.

<?php
namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class GenericAlert extends Notification implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public string $title, public string $body, public ?string $url, public array $channels
    ) {}

    public function via($notifiable): array { return $this->channels; }

    public function toMail($notifiable): MailMessage
    {
        $m = (new MailMessage)->subject($this->title)->line($this->body);
        if ($this->url) $m->action('View', $this->url);
        return $m;
    }

    public function toTelegram($notifiable): string
    {
        return "*{$this->title}*\n{$this->body}" . ($this->url ? "\n{$this->url}" : '');
    }
}
