| { | { | ||||
| //for compound numbering | //for compound numbering | ||||
| $countKPD = $this->compound->withTrashed()->count(); | $countKPD = $this->compound->withTrashed()->count(); | ||||
| $kpd = 'KPD'.$countKPD; | |||||
| $no_siri = date('yn').'-'.$countKPD.'-0'; | $no_siri = date('yn').'-'.$countKPD.'-0'; | ||||
| //only for compound parkir | //only for compound parkir | ||||
| $compoundData = [ | $compoundData = [ | ||||
| 'jenis' => 'Parkir', | 'jenis' => 'Parkir', | ||||
| 'kpd' => 'KPD'.$countKPD, | |||||
| 'kpd' => $kpd, | |||||
| 'nama' => '-', | 'nama' => '-', | ||||
| 'identity' => '-', | 'identity' => '-', | ||||
| 'alamat' => '-', | 'alamat' => '-', | ||||
| $file = ConfidentialFile::create($fileData); | $file = ConfidentialFile::create($fileData); | ||||
| $saved = $file->compound()->create($compoundData); | $saved = $file->compound()->create($compoundData); | ||||
| if($saved){ | if($saved){ | ||||
| // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); | // $compound = Compound::with('ConfidentialFile')->where('kpd',$kpd)->first(); | ||||
| return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | return $this->sendResponse($data, 'Berjaya simpan rekod kompaun!'); | ||||
| } | } | ||||
| return $this->sendError('', 'Tidak berjaya simpan rekod kompaun!'); | |||||
| } | } | ||||
| return $this->sendResponse('Tidak Berjaya!', 'Kesalahan tidak dijumpai!'); | return $this->sendResponse('Tidak Berjaya!', 'Kesalahan tidak dijumpai!'); | ||||
| } | } |