Files
YNWA Fawzy 18edc929b4 Features:
- add apprise notifications to the system.

Fixes:
- Fix ntfy notification layout
- enhance readability of notifications.

Took 9 minutes
2024-10-20 22:44:43 +04:00

44 lines
763 B
PHP

<?php
namespace App\NotificationsChannels;
use Illuminate\Support\Facades\Http;
class Apprise
{
protected $http_client;
public function __construct()
{
$this->http_client = new Http();
}
public function send(array $notification_content )
{
return $this->request($notification_content);
}
protected function request( array $notification_content)
{
$url=env('APPRISE_URL');
if (!$url)
return null;
$response = Http::withHeaders([
"Content-Type"=>"application/json",
"Cache: no",
])
->post($url, $notification_content);
$body = json_decode($response->getBody(), true);
return $body;
}
}