Update source into github
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Services;
|
||||
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Pusher\ApiErrorException;
|
||||
use Pusher\Pusher;
|
||||
use Pusher\PusherException;
|
||||
|
||||
class PusherNotification
|
||||
{
|
||||
//
|
||||
/**
|
||||
* @throws PusherException
|
||||
* @throws ApiErrorException
|
||||
* @throws GuzzleException
|
||||
* @throws \JsonException
|
||||
*/
|
||||
public function Notification($message = '', $error = true): void
|
||||
{
|
||||
|
||||
//Pusher
|
||||
$pusher = new Pusher(
|
||||
env('PUSHER_APP_KEY'),
|
||||
env('PUSHER_APP_SECRET'),
|
||||
env('PUSHER_APP_ID'),
|
||||
[
|
||||
'cluster' => env('PUSHER_APP_CLUSTER')
|
||||
]
|
||||
);
|
||||
$pusher->trigger('Notification',
|
||||
'Notification-Event',
|
||||
json_encode([
|
||||
'error' => $error,
|
||||
'message' => $message
|
||||
], JSON_THROW_ON_ERROR));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user