Update WhatsappHelper.php

This commit is contained in:
Jagad R R
2025-03-05 13:47:57 +07:00
parent d0ddc129ae
commit 8cea1b663f
+10 -19
View File
@@ -8,15 +8,6 @@ use Illuminate\Support\Str;
class WhatsappHelper class WhatsappHelper
{ {
protected $wablasHost;
protected $wablasToken;
public function __construct()
{
self::$wablasHost = env('WABLAS_HOST');
self::$wablasToken = env('WABLAS_TOKEN');
}
public static function approveExpense($phones, $expense_number, $url = null, $tanggal, $total, $name) public static function approveExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
{ {
$client = new Client(); $client = new Client();
@@ -48,9 +39,9 @@ class WhatsappHelper
try { try {
// Send the request to the WABLAS API // Send the request to the WABLAS API
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [ $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [ 'headers' => [
'Authorization' => self::$wablasToken, 'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json' 'Content-Type' => 'application/json'
], ],
'json' => [ 'json' => [
@@ -97,9 +88,9 @@ class WhatsappHelper
try { try {
// Send the request to the WABLAS API // Send the request to the WABLAS API
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [ $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [ 'headers' => [
'Authorization' => self::$wablasToken, 'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json' 'Content-Type' => 'application/json'
], ],
'json' => [ 'json' => [
@@ -146,9 +137,9 @@ class WhatsappHelper
try { try {
// Send the request to the WABLAS API // Send the request to the WABLAS API
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [ $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [ 'headers' => [
'Authorization' => self::$wablasToken, 'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json' 'Content-Type' => 'application/json'
], ],
'json' => [ 'json' => [
@@ -195,9 +186,9 @@ class WhatsappHelper
try { try {
// Send the request to the WABLAS API // Send the request to the WABLAS API
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [ $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [ 'headers' => [
'Authorization' => self::$wablasToken, 'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json' 'Content-Type' => 'application/json'
], ],
'json' => [ 'json' => [
@@ -244,9 +235,9 @@ class WhatsappHelper
try { try {
// Send the request to the WABLAS API // Send the request to the WABLAS API
$response = $client->post(self::$wablasHost . '/api/v2/send-message', [ $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [ 'headers' => [
'Authorization' => self::$wablasToken, 'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json' 'Content-Type' => 'application/json'
], ],
'json' => [ 'json' => [