29 lines
718 B
PHP
29 lines
718 B
PHP
<?php
|
|
|
|
namespace App\Libraries;
|
|
|
|
class Wato {
|
|
|
|
protected $api_url;
|
|
protected $api_key;
|
|
protected $company;
|
|
|
|
public function __construct() {
|
|
$this->api_url = defined('WATOAPILINK') ? WATOAPILINK : '';
|
|
$this->api_key = defined('WATOAPIKEY') ? WATOAPIKEY : '';
|
|
$this->company = defined('COMPANY') ? COMPANY : 'Company';
|
|
helper("general");
|
|
}
|
|
|
|
public function pushNotification($mobile, $message) {
|
|
$mobile = str_replace('+', '', $mobile);
|
|
$postFields = [
|
|
'token' => $this->api_key,
|
|
'to' => $mobile,
|
|
'message' => $message
|
|
];
|
|
|
|
return send_api_request('POST', $this->api_url, [], $postFields);
|
|
}
|
|
}
|