mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
30 lines
683 B
PHP
30 lines
683 B
PHP
<?php
|
|
|
|
namespace App\NotificationsChannels;
|
|
|
|
use App\Models\User;
|
|
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, string $notification_content, User $user)
|
|
{
|
|
$url = "{$user->notification_settings['gotify_url']}/message?token={$user->notification_settings['gotify_token']}";
|
|
|
|
$data = [
|
|
"title" => $notification['title'],
|
|
"message" => Str::replace("<br>", "\n", $notification_content),
|
|
];
|
|
|
|
Http::asJson()->post($url, $data);
|
|
}
|
|
}
|