forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSendTelegramTestNotification.php
More file actions
35 lines (28 loc) · 908 Bytes
/
SendTelegramTestNotification.php
File metadata and controls
35 lines (28 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace App\Actions\Notifications;
use App\Notifications\Telegram\TestNotification;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Notification as FacadesNotification;
use Lorisleiva\Actions\Concerns\AsAction;
class SendTelegramTestNotification
{
use AsAction;
public function handle(array $recipients)
{
if (! count($recipients)) {
Notification::make()
->title('You need to add Telegram recipients!')
->warning()
->send();
return;
}
foreach ($recipients as $recipient) {
FacadesNotification::route('telegram_chat_id', $recipient['telegram_chat_id'])
->notify(new TestNotification);
}
Notification::make()
->title('Test Telegram notification sent.')
->success()
->send();
}
}