106 lines
4.3 KiB
PHP
106 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Models\PengajuanSempro;
|
|
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 layananSeminarProposalJob implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public $data;
|
|
public function __construct($data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
if($this->data['jenis']==="penolakan"){
|
|
$text = "BETA\n".
|
|
"Penolakan Pengajuan Seminar Proposal 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 = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id'])
|
|
->select(
|
|
'pengajuan_sempros.caseid',
|
|
'pengajuan_sempros.nilai_plagiasi',
|
|
'mahasiswas.nama',
|
|
'mahasiswas.nim',
|
|
'mahasiswas.email',
|
|
'mahasiswas.judul_seminar_proposal',
|
|
'mahasiswas.dosen_dpu_id',)
|
|
->join('mahasiswas','mahasiswas.id','=','mahasiswas_id')
|
|
->first();
|
|
$text = "BETA - ".$data->caseid."\n".
|
|
"Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n".
|
|
"Kepada mahasiswa : ".$data->nama."\n\n".
|
|
"Alamat Email : ".$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 = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id'])
|
|
->select(
|
|
'pengajuan_sempros.caseid',
|
|
'pengajuan_sempros.nilai_plagiasi',
|
|
'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','=','dosen_dpu_id')
|
|
->first();
|
|
$text = "BETA - ".$data->caseid."\n".
|
|
"Pengajuan Selesai A/N Mahasiswa: ".$data->nama."\n".
|
|
"Kepada DPU : ".$data->nama_gelar."\n\n".
|
|
"Alamat Email : ".$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'){
|
|
$data = PengajuanSempro::where('pengajuan_sempros.id',$this->data['id'])
|
|
->select(
|
|
'pengajuan_sempros.caseid',
|
|
'pengajuan_sempros.nilai_plagiasi',
|
|
'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','=','dosen_dpu_id')
|
|
->first();
|
|
$text = "BETA - ".$data->caseid."\n".
|
|
"Kirim Pengajuan A/N Mahasiswa: ".$data->nama."\n".
|
|
"Kepada DPU : ".$data->nama_gelar."\n\n".
|
|
"Alamat Email : ".$data->email;
|
|
Curl::to('https://api.telegram.org/bot6161516511:AAGZhf_o31HupIogjUbEgvwjukes-3P3zPo/sendMessage')
|
|
->withData( array( 'chat_id' => '-1001903808078', 'text' => $text, 'parse_mode' => 'Markdown') )
|
|
->get();
|
|
}
|
|
}
|
|
}
|