Files
Cybrarist 8d9105eaed Features:
- groups and groups price history

Fixes:
- some env are not reflecting

Took 2 hours 10 minutes
2025-02-14 10:53:24 +04:00

37 lines
871 B
PHP

<?php
namespace App\NotificationsChannels;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
class Gotify
{
protected $httpClient;
public function __construct()
{
$this->httpClient = new Http;
}
public function send(array $notification_title, string $notification_content)
{
$this->request($notification_title, $notification_content);
}
protected function request(array $notification_title, string $notification_content): void
{
$baseUrl = config('settings.gotify_base_url');
$token = config('settings.gotify_token');
$url = "{$baseUrl}/message?token={$token}";
$data = [
"title" => $notification_title['Title'],
"message" => Str::replace("<br>", "\n", $notification_content),
];
Http::asJson()->post($url, $data);
}
}