compound = $compound; } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ private function searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ $dateS = Carbon::createFromFormat('Y-m-d', $start_date); $start = $dateS->copy()->startOfDay(); if($end_date != ''){ $dateE = Carbon::createFromFormat('Y-m-d', $end_date); $end = $dateE->copy()->endOfDay(); }else{ $end = $dateS->copy()->endOfDay(); } if(!empty($day3)) { $compound = Compound::where('jenis_n', $jenis)->whereBetween('created_at', array($start->subDays(3), $end->subDays(3))); } else if(!empty($day7)) { $compound = Compound::where('jenis_n', $jenis)->whereBetween('created_at', array($start->subDays(7), $end->subDays(7))); } else { $compound = Compound::where(function($query) use ($jenis){$query->where('jenis', $jenis)->orWhere('jenis_n', $jenis); }) ->whereBetween('created_at', array($start, $end)); } if($modul == 'All'){ $compound = $compound; }else if($modul == '06-07'){ $compound = $compound->where(function($q){ $q->where('modul', '06')->orWhere('modul','07'); }); }else { $compound = $compound->where('modul', $modul); } if($status == 'All'){ $compound = $compound; }else { $compound = $compound->where('status', $status); } return $compound; } private function searchCompoundAllWithoutDate($jenis,$modul,$status,$day3, $day7){ if(!empty($day3)) { $compound = Compound::where('jenis_n', $jenis)->where('created_at', Carbon::now()->subDays(3)); } else if(!empty($day7)) { $compound = Compound::where('jenis_n', $jenis)->where('created_at', Carbon::now()->subDays(7)); } else { $compound = Compound::where('jenis', $jenis)->orWhere('jenis_n', $jenis); } if($modul == 'All'){ $compound = $compound; }else if($modul == '06-07'){ $compound = $compound->where(function($q){ $q->where(function($query){ $query->where('modul', '06')->orWhere('modul','07'); }); }); }else { $compound = $compound->where('modul', $modul); } if($status == 'All'){ $compound = $compound; }else { $compound = $compound->where('status', $status); } return $compound; } private function filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7){ if(!empty($start_date)){ $compound = $this->searchCompoundAll($jenis,$modul,$status,$start_date,$end_date,$day3, $day7); }else{ $compound = $this->searchCompoundAllWithoutDate($jenis,$modul,$status,$day3, $day7); } // dd($compound->get()); if($enforcer == 'All'){ return $compound; }else { $compound = $compound->where('dikeluarkan', $enforcer)->orWhere('dikeluarkan_n', $enforcer); return $compound; } } private function filterCompoundByFaulty($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$day3, $day7){ $compound = $this->filterCompoundByEnforcer($enforcer,$jenis,$modul,$status,$start_date,$end_date,$day3, $day7); if($faulty == 'All'){ $compound = $compound->whereIn('jbkod', $department); return $compound; }else { $compound = $compound->where('seksyen_kesalahan', $faulty)->orWhere('seksyen_kesalahan_n', $faulty); return $compound; } } private function searchPlateNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$day3, $day7){ $compound = $this->filterCompoundByFaulty($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$day3, $day7); if(!empty($plate_no)){ $compound = $compound->where('no_plate',$plate_no); return $compound; }else{ return $compound; } } private function searchKpd($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$day3, $day7){ $compound = $this->searchPlateNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$day3, $day7); if(!empty($kpd)){ if($modul == '02'){ $compound = $compound->where('kpd',$kpd)->orWhere('non', $kpd); } else{ $compound = $compound->where('kpd',$kpd); } return $compound; }else{ $compound = $compound->whereIn('status', ['Belum Bayar', 'Berbayar', 'Batal']); return $compound; } } private function searchCompanyNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$day3, $day7){ $compound = $this->searchKpd($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$day3, $day7); if(!empty($company_no)){ $compound = $compound->where('no_daftar_syarikat','LIKE',$company_no); return $compound; }else{ return $compound; } } private function searchNric($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$day3, $day7){ $compound = $this->searchCompanyNo($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$day3, $day7); if(!empty($nric)){ $compound = $compound->where('identity',$nric); return $compound; }else{ return $compound; } } private function searchLesen($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$day3, $day7){ $compound = $this->searchNric($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$day3, $day7); if(!empty($license)){ $compound = $compound->where('no_akaun_lesen', 'exists', true)->where('no_akaun_lesen',$license); return $compound; }else{ return $compound; } } private function searchName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$day3, $day7){ $compound = $this->searchLesen($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$day3, $day7); if(!empty($namaP)){ $compound = $compound->where('nama', 'LIKE', "%{$namaP}%"); return $compound; }else{ return $compound; } } private function searchCompanyName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$company_name,$day3, $day7){ $compound = $this->searchName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$day3, $day7); if(!empty($company_name)){ $compound = $compound->where('nama_syarikat', 'exists', true)->where('nama_syarikat', 'LIKE', '%{$company_name%}'); return $compound; }else{ return $compound; } } public function index(Request $request) { // $per_page = ''; // $kpd = ''; // $modul = '02'; // $status = 'All'; // $jenis = 'Notis_NHN'; // if(!empty($request->department)){ // $department = array ( // 0 => '5df355f891d6e66b9c5e626d', // 1 => '5df721c5cde7fd741433c6b2', // 2 => '5df722a24636f4594f4a3c3d', // 3 => '5f17a31795dbfd3320761bfe', // 4 => '5f3b872fea58cb3c1b0e7b8d', // ); // }else { // $department = []; // } // ["5df355f891d6e66b9c5e626d","5df721c5cde7fd741433c6b2","5df722a24636f4594f4a3c3d","5f17a31795dbfd3320761bfe","5f3b872fea58cb3c1b0e7b8d"] // $start_date = ''; // $end_date = ''; // // $start_date = '2020-09-29'; // // $end_date = '2020-10-09'; // $enforcer = 'All'; // $faulty = 'All'; // $plate_no = strtolower(''); // $company_no = strtolower(''); // $nric = ''; // $license = ''; // $namaP = ''; // $company_name = ''; // $day3 = ''; // $day7 = ''; ///////////////////////////////////////////////////////////////////////////////// $per_page = $request->per_page; $kpd = $request->kpd; $modul = $request->modul; $status = $request->status; $jenis = $request->type; if(!empty($request->department)){ $department = json_decode($request->department); }else { $department = []; } $start_date = $request->start_date; $end_date = $request->end_date; $enforcer = $request->enforcer; $faulty = $request->faulty; $plate_no = strtolower($request->plate_no); $company_no = strtolower($request->company_no); $nric = $request->nric; $license = $request->license; $namaP = $request->nameP; $company_name = $request->company_name; $day3=''; $day7=''; if ($request->has('day3')) { $day3 = $request->day3; //has() checks if param exist and filled } if ($request->has('day7')) { $day3 = $request->day7; //has() checks if param exist and filled } $nested_data = array(); $compound = $this->searchCompanyName($enforcer,$faulty,$jenis,$modul,$status,$start_date,$end_date,$department,$plate_no,$kpd,$company_no,$nric,$license,$namaP,$company_name, $day3, $day7)->orderBy('created_at','ASC')->get(); info($compound); return \DataTables::of(CompoundResource::collection($compound))->addIndexColumn() ->addColumn('index', function($row) { $curr = Carbon::now(); $dtC = Carbon::parse($row['created_at'])->setTimezone('Asia/Kuala_Lumpur'); if($curr->diffInDays($dtC) <= 3){ $html = 'New'; }else{ $html = ''; } return $html; })->addColumn('status_kemaskini', function($row) { $data = ''; if($row['status'] == 'Berbayar'){ if ($row['modul'] == '02') { $data = 'Selesai

'; $data .= '
Catatan:
'.$row['catatan_dari_admin'].'
'; } else{ $data = ''.$row['status'].'
Bayaran:
'; $data .= 'RM '.$row['amount_payment'].'
'; $data .= '
Catatan:
'.$row['catatan_dari_admin'].'
'; } if($row['updated_by'] !== null ){ $data .= '
Kemaskini:
'; $data .= $row['updated_at'].'
'.$row['updated_by']['no_badan'].'
'; }else { if(!empty($row['tarikh_bayar']) && $row['tarikh_bayar'] != ''){ $data .= '
Kemaskini:
'; $data .= $row['tarikh_bayar'].'
'.$row['updates_by'].'
'; }else { $data .= '
Kemaskini:
'; $data .= $row['updated_at'].'
'.$row['updates_by'].'
'; } } }else if($row['status'] == 'Belum Bayar' && $row['updated_by'] !== null){ $data = ''.$row['status'].''; $data .= '
Catatan:
'.$row['catatan_dari_admin'].'
'; $data .= '
Kemaskini:
'; $data .= $row['updated_at'].'
'.$row['updated_by']['no_badan'].'
'; }else if($row['status'] == 'Batal' && $row['updated_by'] !== null){ $data = ''.$row['status'].''; $data .= '
Catatan:
'.$row['catatan_dari_admin'].'
'; $data .= '
Kemaskini:
'; $data .= $row['updated_at'].'
'.$row['updated_by']['no_badan'].'
'; }else if($row['status'] == 'Buang' && $row['updated_by'] !== null){ $data = ''.$row['status'].''; $data .= '
Catatan:
'.$row['catatan_dari_admin'].'
'; $data .= '
Kemaskini:
'; $data .= $row['updated_at'].'
'.$row['updated_by']['no_badan'].'
'; } else { $data = $row['status']; } return $data; })->addColumn('kesalahan', function($row) { $data = 'Seksyen '.$row['faulty_skter'].'
'.$row['faulty_name']; return $data; })->rawColumns(['index','status_kemaskini','kesalahan'])->make(true); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function generateNumber($jenis, $tag, $modul) { $num= ''; if($modul == '02') { //check if theres no 001, start fresh with 0001 if (empty(Compound::where('jenis_n', $jenis)->where('non', $tag.'0001')->first())) { $num = '0001'; } else{ //check the lastest compound number stored in dbase filtered by jenis $notice = Compound::where('jenis_n', $jenis)->withTrashed()->latest()->first(); //sanitize compound number to return only integer $num = filter_var($notice['non'], FILTER_SANITIZE_NUMBER_INT); //compulsory increment to store new compound number, WHILE number is found, keep looping do{ (int)$num += 1; //add 0s at the fornt if number is less than 1000 if ((strlen((string) $num)) == 1) { $num = '000'.$num; }elseif ((strlen((string)$num)) == 2){ $num = '00'.$num; }elseif ((strlen((string)$num )) == 3) { $num = '0'.$num; } }while(!empty(Compound::where('jenis_n', $jenis)->where('non', $tag.$num)->first())); } }else if($modul == '03') { //check if theres no 001, start fresh with 0001 if (empty(Compound::where('jenis', $jenis)->where('kpd', $tag.'0001')->first())) { $num = '0001'; } else{ //check the lastest compound number stored in dbase filtered by jenis $compound = Compound::where('jenis', $jenis)->withTrashed()->latest()->first(); //sanitize compound number to return only integer $num = filter_var($compound['kpd'], FILTER_SANITIZE_NUMBER_INT); //compulsory increment to store new compound number, WHILE number is found, keep looping do{ (int)$num += 1; //add 0s at the fornt if number is less than 1000 if ((strlen((string) $num)) == 1) { $num = '000'.$num; }elseif ((strlen((string)$num)) == 2){ $num = '00'.$num; }elseif ((strlen((string)$num )) == 3) { $num = '0'.$num; } }while(!empty(Compound::where('jenis', $jenis)->where('kpd', $tag.$num)->first())); } } //return kpd with tag $num = $tag . $num; return $num; } /** * Store a created compound from notice. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first(); if(empty($staff)){ return $this->sendError('Invalid', 'Staff not existed'); }else { $saved =''; $kpd = ''; $no_siri = ''; $data = array(); $faulty = $request->seksyen; $faulty = Faulty::where('_id',$request->get('seksyen'))->orWhere('nama', 'like', $faulty)->first(); if($request->jenis == 'Parkir') { if(!empty($faulty)){ $countKPD = $this->compound->withTrashed()->count(); do { $countKPD = $countKPD + 1; } while (!empty(Compound::where("kpd", "=", 'KP'.$countKPD)->first())); $kpd = 'KP'.$countKPD; $no_siri = date('yn').'-'.$countKPD; $fileData = [ 'no_siri' => $no_siri, ]; //only for compound parkir $compoundData = [ 'jenis' => 'Parkir', 'kpd' => 'KPD'.$kpd, 'nama' => '-', 'identity' => '-', 'alamat' => '-', "no_plate" => strtolower($request->no_plate), "no_cukai_jalan" => $request->noCukaijalan, "jenis_kenderaan" => $request->jenisKenderaan, "model_kenderaan" => $request->modelKenderaan, "warna_kenderaan" => $request->warnakenderaan, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "no_parking" => $request->noParking, "catatan" => $request->catatan, "lokasi_kejadian" => '-', 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $staff->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => '03', "penguatkuasa" => '-', "created_c" => Carbon::now()->toDateTimeString(), ]; $file = ConfidentialFile::create($fileData); $saved = $file->compound()->create($compoundData); } }elseif(($request->jenis == 'Pelbagai_KT') || ($request->jenis == 'Pelbagai_JPB')){ $compound = Compound::where('jenis_n', $request->jenis)->orWhere('non', $request->non)->first(); if(!empty($compound)) { $saved = ''; if(!($compound->modul == '03' && isset($compound->kpd))) { if($request->jenis == 'Pelbagai_KT'){ $kpd = $this->generateNumber($request->jenis, 'KT', '03'); $compound->kpd = $kpd; $compound->jenis = $request->jenis; $compound->nama = $request->namaP; $compound->identity = $request->noIc; $compound->nama_syarikat = $request->namaS; $compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->alamat = $request->alamat; $compound->lokasi_kejadian = $request->alamat_tempat_kesalahan; // $compound->no_plate = $request->no_plate; // $compound->no_cukai_jalan = $request->no_cukai_jalan; // $compound->nama_kawasan = $request->namaKawasan; // $compound->nama_taman = $request->namaTaman; // $compound->nama_jalan = $request->namaJalan; $compound->butiran_kesalahan = $request->butiran_kesalahan; $compound->catatan = $request->catatan; $compound->latlong = $request->Latlong; $compound->akta = $faulty->deed_law_id; $compound->seksyen_kesalahan = $faulty->_id; $compound->jumlah_asal_kompaun = $faulty->amount; $compound->dikeluarkan = $staff->_id; $compound->status = 'Belum Bayar'; $compound->modul = '03'; $compound->no_akaun_lesen = $request->lesen; $compound->created_c = Carbon::now()->toDateTimeString(); }elseif($request->jenis == 'Pelbagai_JPB'){ $kpd = $this->generateNumber($request->jenis, 'JPB', '03'); $compound->kpd = $kpd; $compound->jenis = $request->jenis; $compound->nama = $request->namaP; $compound->identity = $request->noIc; $compound->nama_syarikat = $request->namaS; $compound->no_daftar_syarikat = strtolower($request->daftarNo); $compound->alamat = $request->alamat; $compound->lokasi_kejadian = $request->alamat_tempat_kesalahan; // $compound->no_plate = $request->no_plate; // $compound->no_cukai_jalan = $request->no_cukai_jalan; // $compound->nama_kawasan => $request->namaKawasan; // $compound->nama_taman => $request->namaTaman; // $compound->nama_jalan => $request->namaJalan; $compound->butiran_kesalahan = $request->butiran_kesalahan; $compound->catatan = $request->catatan; $compound->latlong = $request->Latlong; $compound->akta = $faulty->deed_law_id; $compound->seksyen_kesalahan = $faulty->_id; $compound->jumlah_asal_kompaun = $faulty->amount; $compound->dikeluarkan = $staff->_id; $compound->status = 'Belum Bayar'; $compound->modul = '03'; $compound->no_akaun_lesen = $request->lesen; $compound->created_c = Carbon::now()->toDateTimeString(); } $saved = $compound->save(); } else { return $this->sendResponse('', 'Kompaun ini telah dikeluarkan!'); } if($saved){ // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); // if(!empty($compound)){ // dispatch(new UpdateCompoundPrice($kpd)); // $tawaran = ''; // if($compound->jumlah_kemaskini_kompaun != ''){ // $tawaran = $compound->jumlah_kemaskini_kompaun; // }else{ // $tawaran = $compound->jumlah_asal_kompaun; // } $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); array_push($data, array('kpd' => $kpd)); // $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); // } } } else{ return $this->sendResponse('', 'Kompaun ini tidak dijumpai!'); } } } } /** * * Store a newly created notice * **/ public function storeNewNotice(Request $request) { $staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first(); if(empty($staff)){ return $this->sendError('Invalid', 'Staff not existed'); }else { $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); if(!empty($faulty)){ $data = array(); $non = ''; // $kpd = ''; $no_siri =''; $noticeData = []; if($request->jenis == 'Parkir'){ //for compound numbering // $countKPD = $this->compound->withTrashed()->count(); // $kpd = 'KPD'.$countKPD; // $non = 'KPD'.$countKPD; // $no_siri = date('yn').'-'.$countKPD.'-0'; // $compoundData = [ // 'jenis' => 'Parkir', // 'kpd' => $kpd, // 'non' => $non, // 'nama' => '-', // 'identity' => '-', // 'alamat' => '-', // "no_plate" => strtolower($request->no_plate), // "no_cukai_jalan" => $request->noCukaijalan, // "jenis_kenderaan" => $request->jenisKenderaan, // "model_kenderaan" => $request->modelKenderaan, // "warna_kenderaan" => $request->warnakenderaan, // "nama_kawasan" => $request->namaKawasan, // "nama_taman" => $request->namaTaman, // "nama_jalan" => $request->namaJalan, // "no_parking" => $request->noParking, // "catatan" => $request->catatan, // "lokasi_kejadian" => '-', // 'latlong' => $request->Latlong, // 'jbkod' => $request->jabatan, // 'akta' => $faulty->deed_law_id, // 'seksyen_kesalahan' => $faulty->_id, // 'jumlah_asal_kompaun' => $faulty->amount, // 'jumlah_kemaskini_kompaun' => '-', // 'dikeluarkan' => $staff->_id, // "status" => 'Belum Bayar', // "amount_payment" => '-', // "receipt" => '-', // "modul" => $request->modul, // "penguatkuasa" => '-', // "notis_created" => Carbon::now()->toDateTimeString(), // ]; }elseif($request->jenis == 'Notis_NKG'){ // $kpd = $this->generateNumber($request->jenis, 'KT', '02'); // $non = 'NKG'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT); $non = $this->generateNumber($request->jenis, 'NKG', '02'); $no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-1'; $noticeData = [ 'jenis' => 'Pelbagai_KT', 'jenis_n' => $request->jenis, 'kpd' => '-', 'non' => $non, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "butiran_kesalahan_n" => $request->butiran_kesalahan, "lokasi_kejadian" => $request->alamat_tempat_kesalahan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta_n' => $faulty->deed_law_id, 'seksyen_kesalahan_n' => $faulty->_id, 'dikeluarkan_n' => $staff->_id, "status" => 'Belum Bayar', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, // "maklumat_tambahan" => $request->butiran_kesalahan, "tindakan" => $request->tindakan, "tempoh" => $request->tempoh, // "tempoh_tarikh" => Carbon::now()->addDays($request->tempoh)->toiso(), "created_n" => Carbon::now()->toDateTimeString(), ]; }elseif($request->jenis == 'Notis_NMH'){ // $kpd = $this->generateCompoundNumber($request->jenis, 'JPB'); // $non = 'NMH'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT); $non = $this->generateNumber($request->jenis, 'NMH', '02'); $no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-2'; $noticeData = [ 'jenis' => 'Pelbagai_JPB', 'jenis_n' => $request->jenis, 'kpd' => '-', 'non' => $non, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "butiran_kesalahan_n" => $request->butiran_kesalahan, "lokasi_kejadian" => $request->alamat_tempat_kesalahan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta_n' => $faulty->deed_law_id, 'seksyen_kesalahan_n' => $faulty->_id, 'dikeluarkan_n' => $staff->_id, "status" => 'Belum Bayar', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, // "maklumat_tambahan" => $request->butiran_kesalahan, "tindakan" => $request->tindakan, "tempoh" => $request->tempoh, // "tempoh_tarikh" => Carbon::now()->addDays($request->tempoh)->toISOString(), "created_n" => Carbon::now()->toDateTimeString(), ]; } elseif($request->jenis == 'Notis_NHN'){ //HN bcs other N stands for notice. compound number no need front N // $kpd = $this->generateCompoundNumber($request->jenis, 'HN'); // $non = 'NHN'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT); $non = $this->generateNumber($request->jenis, 'NHN', '02' ); $no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-3'; $noticeData = [ 'jenis' => 'Pelbagai_KT', 'jenis_n' => $request->jenis, 'kpd' => '-', 'non' => $non, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "butiran_kesalahan_n" => $request->butiran_kesalahan, "lokasi_kejadian" => $request->alamat_tempat_kesalahan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta_n' => $faulty->deed_law_id, 'seksyen_kesalahan_n' => $faulty->_id, 'dikeluarkan_n' => $staff->_id, "status" => 'Belum Bayar', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, // "maklumat_tambahan" => $request->butiran_kesalahan, "tindakan" => '-', "tempoh" => $request->tempoh, // "tempoh_tarikh" => Carbon::now()->addDays($request->tempoh)->toISOString(), "created_n" => Carbon::now()->toDateTimeString(), ]; } elseif($request->jenis == 'Notis_PA'){ // $kpd = $this->generateCompoundNumber($request->jenis, 'PA'); // $non = 'PA'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT); $non = $this->generateNumber($request->jenis, 'PA', '02'); $no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-4'; $noticeData = [ 'jenis' => 'Pelbagai_KT', 'jenis_n' => $request->jenis, 'kpd' => '-', 'non' => $non, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "butiran_kesalahan_n" => $request->butiran_kesalahan, "lokasi_kejadian" => $request->alamat_tempat_kesalahan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta_n' => $faulty->deed_law_id, 'seksyen_kesalahan_n' => $faulty->_id, 'dikeluarkan_n' => $staff->_id, "status" => 'Belum Bayar', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, // "maklumat_tambahan" => $request->butiran_kesalahan, "tindakan" => $request->tindakan, "tempoh" => $request->tempoh, // "tempoh_tarikh" => Carbon::now()->addDays($request->tempoh)->toISOString(), "created_n" => Carbon::now()->toDateTimeString(), "bil_haiwan" => $request->bil_haiwan, ]; }elseif($request->jenis == 'Notis_NPPM'){ // $kpd = $this->generateCompoundNumber($request->jenis, 'PA'); // $non = 'PA'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT); $non = $this->generateNumber($request->jenis, 'NPPM', '02'); $no_siri = date('yn').'-'.filter_var($non, FILTER_SANITIZE_NUMBER_INT).'-5'; $noticeData = [ 'jenis' => 'Pelbagai_KT', 'jenis_n' => $request->jenis, 'kpd' => '-', 'non' => $non, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "butiran_kesalahan_n" => $request->butiran_kesalahan, "lokasi_kejadian" => $request->alamat_tempat_kesalahan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta_n' => $faulty->deed_law_id, 'seksyen_kesalahan_n' => $faulty->_id, 'dikeluarkan_n' => $staff->_id, "status" => 'Belum Bayar', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, // "maklumat_tambahan" => $request->butiran_kesalahan, "tindakan" => '-', "tempoh" => $request->tempoh, // "tempoh_tarikh" => Carbon::now()->addDays($request->tempoh)->toISOString(), "created_n" => Carbon::now()->toDateTimeString(), ]; } $fileData = [ 'no_siri' => $no_siri, ]; $file = ConfidentialFile::create($fileData); $saved = $file->compound()->create($noticeData); if($saved){ // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); // if(!empty($compound)){ // dispatch(new UpdateCompoundPrice($kpd)); // $tawaran = ''; // if($compound->jumlah_kemaskini_kompaun != ''){ // $tawaran = $compound->jumlah_kemaskini_kompaun; // }else{ // $tawaran = $compound->jumlah_asal_kompaun; // } $this->dispatch(new StoreNotice($request->all(), $non, $staff->_id, $no_siri)); //mobile already accept 'kpd' string, so no need to change string name to 'notis'. array_push($data, array( 'non' => $non )); return $this->sendResponse($data, 'Berjaya simpan rekod notis!'); // } } } } } /** * Store a newly created compound (parkir, KT, JPB). * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function storeNewCompound(Request $request) { $staff = Staff::with('StaffDetail')->where('api_token',$request->api_token)->first(); if(empty($staff)){ return $this->sendError('Invalid', 'Staff not existed'); }else { $data = array(); $faulty = Faulty::where('_id',$request->get('seksyen'))->first(); if(!empty($faulty)){ $kpd = ''; $no_siri =''; if($request->jenis == 'Parkir') { //for compound numbering $countKPD = $this->compound->where('jenis','Parkir')->withTrashed()->count(); $kpd = 'KPD'.$countKPD; $no_siri = date('yn').'-'.$countKPD.'-0K'; //only for compound parkir $compoundData = [ 'jenis' => 'Parkir', 'kpd' => $kpd, 'nama' => '-', 'identity' => '-', 'alamat' => '-', "no_plate" => strtolower($request->no_plate), "no_cukai_jalan" => $request->noCukaijalan, "jenis_kenderaan" => $request->jenisKenderaan, "model_kenderaan" => $request->modelKenderaan, "warna_kenderaan" => $request->warnakenderaan, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, "no_parking" => $request->noParking, "catatan" => $request->catatan, "lokasi_kejadian" => '-', 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $staff->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => '03', "penguatkuasa" => '-', "created_c" => Carbon::now()->toDateTimeString(), ]; } elseif ($request->jenis == 'Pelbagai_KT') { $kpd = $this->generateNumber($request->jenis, 'KT', '03'); $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-1K'; $compoundData = [ 'jenis' => $request->jenis, 'kpd' => $kpd, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "lokasi_kejadian" => $request->alamat_tempat_pesalah, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, "butiran_kesalahan" => $request->butiran_kesalahan, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $staff->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, "created_c" => Carbon::now()->toDateTimeString(), ]; } elseif ($request->jenis == 'Pelbagai_JPB') { $kpd = $this->generateNumber($request->jenis, 'JPB', '03'); $no_siri = date('yn').'-'.filter_var($kpd, FILTER_SANITIZE_NUMBER_INT).'-2K'; $compoundData = [ 'jenis' => $request->jenis, 'kpd' => $kpd, 'nama' => $request->namaP, 'identity' => $request->noIc, 'nama_syarikat' => $request->namaS, 'no_daftar_syarikat' => strtolower($request->daftarNo), 'alamat' => $request->alamat, "lokasi_kejadian" => $request->alamat_tempat_pesalah, "nama_kawasan" => $request->namaKawasan, "nama_taman" => $request->namaTaman, "nama_jalan" => $request->namaJalan, 'latlong' => $request->Latlong, 'jbkod' => $request->jabatan, 'akta' => $faulty->deed_law_id, 'seksyen_kesalahan' => $faulty->_id, "butiran_kesalahan" => $request->butiran_kesalahan, 'jumlah_asal_kompaun' => $faulty->amount, 'jumlah_kemaskini_kompaun' => '-', 'dikeluarkan' => $staff->_id, "status" => 'Belum Bayar', "amount_payment" => '-', "receipt" => '-', "modul" => $request->modul, "penguatkuasa" => '-', "no_akaun_lesen" => $request->lesen, "created_c" => Carbon::now()->toDateTimeString(), ]; } $fileData = [ 'no_siri' => $no_siri, ]; $file = ConfidentialFile::create($fileData); $saved = $file->compound()->create($compoundData); if($saved){ // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); // if(!empty($compound)){ // dispatch(new UpdateCompoundPrice($kpd)); // $tawaran = ''; // if($compound->jumlah_kemaskini_kompaun != ''){ // $tawaran = $compound->jumlah_kemaskini_kompaun; // }else{ // $tawaran = $compound->jumlah_asal_kompaun; // } $this->dispatch(new StoreCompound($request->all(), $kpd, $staff->_id, $no_siri)); array_push($data, array('kpd' => $kpd)); // $this->dispatch(new StoreCompoundEPBT($request->all(), $kpd, $staff->StaffDetail->full_name, $staff->StaffDetail->no_badan, $faulty->nama)); return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); } return $this->sendError('', 'Tidak berjaya simpan rekod kompaun!'); } return $this->sendResponse('Tidak Berjaya!', 'Kesalahan tidak dijumpai!'); } } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } public function updateStatusNoticeViaDashboard(Request $request) { $compound = $this->compound::with('ConfidentialFile')->find($request->id); $staff = StaffDetail::find($request->current_id); if(!empty($compound) && !empty($staff)){ if($staff->roles_access == "sysadmin" || $staff->roles_access == "Ketua Jabatan"){ if($compound->status != $request->status){ $compound->status = $request->status; $compound->catatan_dari_admin = $request->remark; $compound->update_by = $request->current_id; $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Status notis ".$compound->kpd. " telah dikemaskini", 'huraian' => "Status penyelesaian notis telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } if($request->status == "Berbayar"){ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis Dijelaskan" '); }else{ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun/Notis DiBatalkan" '); } }else{ $response = [ 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ if($request->remark != ''){ $compound->catatan_dari_admin = $request->remark; $compound->update_by = $request->current_id; $compound->save(); $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", 'huraian' => "Catatan notis ini telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } return $this->sendResponse('', 'Berjaya tambah catatan untuk notis ini'); }else{ $response = [ 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ $response = [ 'success' => false, 'message' => 'Tiada kemaskini!', ]; return response()->json($response, 200); } } }else{ if($compound->status != 'Berbayar' && $compound->status != $request->status){ $compound->status = $request->status; $compound->catatan_dari_admin = $request->remark; // $compound->amount_payment = $request->amount; $compound->update_by = $request->current_id; $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Status notis telah dikemaskini", 'huraian' => "Status penyelesaian notis telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } if($request->status == "Berbayar"){ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis Dijelaskan" '); }else{ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk notis ini di modul kategori "Kompaun/Notis DiBatalkan" '); } }else{ $response = [ 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ if($request->remark != ''){ $compound->catatan_dari_admin = $request->remark; $compound->update_by = $request->current_id; $compound->save(); $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", 'huraian' => "Catatan notis ini telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } return $this->sendResponse('', 'Berjaya tambah catatan untuk notis ini'); }else{ $response = [ 'success' => false, 'message' => 'Notis ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ $response = [ 'success' => false, 'message' => 'Tiada kemaskini!', ]; return response()->json($response, 200); } } } }else{ $response = [ 'success' => false, 'message' => 'Notis ini tidak dijumpai / staff tidak ditemui', ]; return response()->json($response, 200); } } public function updateStatusPaymentViaDashboard(Request $request) { $compound = $this->compound::with('ConfidentialFile')->find($request->id); $staff = StaffDetail::find($request->current_id); if(!empty($compound) && !empty($staff)){ if($staff->roles_access == "sysadmin" || $staff->roles_access == "Ketua Jabatan"){ if($compound->status != $request->status){ $compound->status = $request->status; $compound->catatan_dari_admin = $request->remark; $compound->amount_payment = $request->amount; $compound->update_by = $request->current_id; $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Status pembayaran kompaun ".$compound->kpd. " telah dikemaskini", 'huraian' => "Status pembayaran kompaun (RM ".$request->amount.") telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } if($request->status == "Berbayar"){ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun Dijelaskan" '); }else{ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); } }else{ $response = [ 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ if($request->remark != ''){ $compound->catatan_dari_admin = $request->remark; $compound->update_by = $request->current_id; $compound->save(); $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", 'huraian' => "Catatan kompaun ini telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } return $this->sendResponse('', 'Berjaya tambah catatan untuk kompaun ini'); }else{ $response = [ 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ $response = [ 'success' => false, 'message' => 'Tiada kemaskini!', ]; return response()->json($response, 200); } } }else{ if($compound->status != 'Berbayar' && $compound->status != $request->status){ $compound->status = $request->status; $compound->catatan_dari_admin = $request->remark; $compound->amount_payment = $request->amount; $compound->update_by = $request->current_id; $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Status pembayaran kompaun ".$compound->kpd. " telah dikemaskini", 'huraian' => "Status pembayaran kompaun (RM ".$request->amount.") telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } if($request->status == "Berbayar"){ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun Dijelaskan" '); }else{ return $this->sendResponse('', 'Berjaya kemaskini status. Sila rujuk kompaun ini di modul kategori "Kompaun DiBatalkan" '); } }else{ $response = [ 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ if($request->remark != ''){ $compound->catatan_dari_admin = $request->remark; $compound->update_by = $request->current_id; $compound->save(); $saved = $compound->save(); if($saved){ $gDate = $compound->created_at->format('F Y'); $historyData = [ 'tarikh_kumpulan' => $gDate, ]; $subHistory = [ 'no_siri' => $compound->ConfidentialFile->no_siri, 'tajuk' => "Catatan ".$compound->kpd. " telah ditambah/dikemaskini", 'huraian' => "Catatan kompaun ini telah dikemaskini melalui 'dashboard' oleh ".$staff->full_name."", ]; $groupByDate = History::where('tarikh_kumpulan', $gDate)->first(); if(!empty($groupByDate)){ $groupByDate->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($groupByDate); }else{ $history = History::create($historyData); $history->subhistory()->create($subHistory); $historySaved = $compound->ConfidentialFile->history()->attach($history); } return $this->sendResponse('', 'Berjaya tambah catatan untuk kompaun ini'); }else{ $response = [ 'success' => false, 'message' => 'Kompaun ini tidak berjaya dikemaskini', ]; return response()->json($response, 200); } }else{ $response = [ 'success' => false, 'message' => 'Tiada kemaskini!', ]; return response()->json($response, 200); } } } }else{ $response = [ 'success' => false, 'message' => 'Kompaun ini tidak dijumpai / staff tidak ditemui', ]; return response()->json($response, 200); } } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }