mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- groups and groups price history Fixes: - some env are not reflecting Took 2 hours 10 minutes
37 lines
871 B
PHP
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);
|
|
}
|
|
}
|