mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:10:10 +00:00
a47e3225e5
Co-authored-by: Sven van Ginkel <svenvanginkel@icloud.com> Co-authored-by: Alex Justesen <1144087+alexjustesen@users.noreply.github.com>
41 lines
953 B
PHP
41 lines
953 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Apprise;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class SpeedtestNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public string $title,
|
|
public string $body,
|
|
public string $type = 'info',
|
|
) {}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['apprise'];
|
|
}
|
|
|
|
/**
|
|
* Get the Apprise message representation of the notification.
|
|
*/
|
|
public function toApprise(object $notifiable): AppriseMessage
|
|
{
|
|
return AppriseMessage::create()
|
|
->urls($notifiable->routes['apprise_urls'])
|
|
->title($this->title)
|
|
->body($this->body)
|
|
->type($this->type);
|
|
}
|
|
}
|