data = $data; } /** * Execute the job. */ public function handle(): void { if($this->data['jenis']==="penolakan"){ $text = "BETA\n". "Penolakan Pengajuan Mahasiswa: ".$this->data['nama']."\n". "Dengan Email : ".$this->data['email']."\n\n". "Alasan : ".$this->data['alasan']; Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) ->get(); } elseif($this->data['jenis'] == 'dpu'){ $data = PengajuanDpuDpa::where('pengajuan_dpu_dpas.id',$this->data['id']) ->select('mahasiswas.nama', 'mahasiswas.nim', 'mahasiswas.judul_seminar_proposal', 'mahasiswas.dosen_dpu_id', 'users.nama_gelar', 'users.email') ->join('mahasiswas','mahasiswas.id','=','mahasiswas_id') ->join('users','users.id','=','mahasiswas.dosen_dpu_id') ->first(); $text = "BETA\n". "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". "Kepada DPU : ".$data->nama_gelar."\n\n". "Alamat Email : ".str_replace('_','\_',$data->email); Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) ->get(); } elseif($this->data['jenis'] == 'dpa'){ try{ $data = PengajuanDpuDpa::where('pengajuan_dpu_dpas.id',$this->data['id']) ->select('mahasiswas.nama', 'mahasiswas.nim', 'mahasiswas.judul_seminar_proposal', 'mahasiswas.dosen_dpa_id', 'users.nama_gelar', 'users.email') ->join('mahasiswas','mahasiswas.id','=','mahasiswas_id') ->join('users','users.id','=','mahasiswas.dosen_dpa_id') ->first(); $text = "BETA\n". "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". "Kepada DPA : ".$data->nama_gelar."\n\n". "Alamat Email : ". str_replace('_','\_',$data->email); Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => strval($text), 'parse_mode' => 'Markdown') ) ->get(); }catch(Exception $e){ Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $e, 'parse_mode' => 'Markdown') ) ->get(); } } elseif($this->data['jenis'] == 'kombi'){ $kombiRole = Role::findByName('Ketua Kombi')->users; $data = PengajuanDpuDpa::where('pengajuan_dpu_dpas.id',$this->data['id'])->select('mahasiswas.nama','mahasiswas.nim','mahasiswas.judul_seminar_proposal')->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')->first(); $text = "BETA\n". "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". "Kepada Komisi Bimbingan : ".$kombiRole[0]->nama_gelar."\n\n". "Alamat Email : ".$kombiRole[0]->email; Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) ->get(); } elseif($this->data['jenis'] == 'mahasiswa'){ $data = PengajuanDpuDpa::where('pengajuan_dpu_dpas.id',$this->data['id'])->select('mahasiswas.nama','mahasiswas.nim','mahasiswas.judul_seminar_proposal','mahasiswas.email')->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')->first(); $text = "BETA\n". "Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n". "Kepada Mahasiswa : ".$data->nama."\n\n". "Alamat Email : ".str_replace('_','\_',$data->email); Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) ->get(); } elseif($this->data['jenis'] == 'mahasiswa selesai'){ $data = PengajuanDpuDpa::where('pengajuan_dpu_dpas.id',$this->data['id'])->select('mahasiswas.nama','mahasiswas.nim','mahasiswas.judul_seminar_proposal','mahasiswas.email')->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')->first(); $text = "BETA\n". "Kirim Notifikasi Pengajuan Selesai A/N Mahasiswa: ".$data->nama."\n". "Kepada Mahasiswa : ".$data->nama."\n\n". "Alamat Email : ".str_replace('_','\_',$data->email); Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage') ->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') ) ->get(); } } }