<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;


use Ixudra\Curl\Facades\Curl;

class kirimNotifikasiErrorJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $data;
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Execute the job.
     */
    public function handle(): void
    {
        $text = $this->data['error']; 
        Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage')
            ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') )
            ->get();
    }
}
