Files
lelong/app/Jobs/WhatsappTidakSahBayaran.php
T
2024-07-01 13:20:37 +08:00

59 lines
1.6 KiB
PHP

<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\LogUser;
use App\Models\User;
use Illuminate\Support\Facades\Http;
class WhatsappTidakSahBayaran implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $user_namapembida;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($user_namapembida)
{
$this->user_namapembida = $user_namapembida;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$getnoajk = User::where('user_type', 3)->get();
foreach($getnoajk as $notifikasi){
$mobile_no = '6'.$notifikasi->notelbimbit;
if(config('app.env') != 'production'){
$mobile_no = config('app.admin_phone_number');
}
$response = Http::get(env('WABOT_API'), [
'number' => $mobile_no,
'type' => 'text',
'message' => 'Bayaran Pembida yang bernama *'.$this->user_namapembida.'* Adalah *Tidak Sah*, Mohon Pihak AJK Lelong Untuk Buat Semakan, Terima Kasih.' ,
'instance_id' => env('WABOT_INSTANCES_ID'),
'access_token' => env('WABOT_TOKEN_KEYS')
]);
}
}
}