/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { // dd($request->all()); $skpd = new Skpd(); $skpd->nama_skpd = $request->nama_skpd; $skpd->nama_singkat_skpd = $request->nama_singkat_skpd; $skpd->save(); $data['code'] = 200; $data['msg'] = 'Tambah data SUkses'; return $data; // }
function per_skpd_tahun($tahun = '', $skpd_id = '') { // dd($this->req->all()); if ($this->req->get('tahun') && $this->req->get('skpd_id')) { $tahun = $this->req->get('tahun'); $skpd_id = $this->req->get('skpd_id'); // $nama_skpd=Skpd::find($skpd_id)->toArray(); /* get data filter skpd dokument======================================================================================*/ $skpd = Skpd::find($skpd_id)->toArray(); /* get rekap data dokument======================================================================================*/ $jenissppd_s = Jenissppd::all(); // dd($jenissppd_s); $data['rows'] = array(); foreach ($jenissppd_s as $key => $jenissppd) { // dd($jenissppd->rekapdokumen($tahun,$skpd_id)->toArray()); $data['rows'][$key] = array_merge($jenissppd->toArray(), $jenissppd->rekapdokumen($tahun, $skpd_id)->toArray()); } /* get rekap total dokument======================================================================================*/ $dokumen = new Dokumens(); $total = $dokumen->rekaptotal($tahun, $skpd_id)->toArray(); return $data + $this->req->all() + $skpd + $total; // return collect($data)->merge( $this->req->all())->merge( $skpd)->merge($total); // dd($data); } }
public function anyCombobox($value = '') { $data = Skpd::orderBy('nama_skpd', 'asc')->get(); return $data; }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Request $req, $id) { $data = Dokumens::find($id); $v_data = $data->toArray(); // dd($data); if (count($data->file()->get()->toArray()) && $data->file) { // dd($data->file()->get()); // $image['image'] = '<img src="'.route('file.get',['filename'=>$data->file()->get()[0]->filename]).'" alt="'.$data->file()->get()[0]->filename.'">'; // $dir=$data->file->dir; // $link_pdf['link_pdf'] =route('file.get',['dir'=>$dir,'filename'=>$data->file()->get()[0]->filename]); // $id=$data->file[0]->id; // $link_pdf['link_pdf'] =route('file.get',['id'=>base64_encode($id)]); // dd($data->file->toArray()); foreach ($data->file as $key => $file) { $urutanx = !empty($file['urutan']) ? $file['urutan'] : 0; // $link_pdf['link_pdf'][$urutanx] =route('file.get',['id'=>base64_encode($file->id)]); // $link_pdf['link_pdf'][$file['urutan']] =route('file.get',['id'=>base64_encode($file->id)]); $link_pdf['link_pdf'][$key] = route('file.get', ['id' => base64_encode($file->id)]); } } else { // $image['image'] = '<img src="xx.jpg" alt="xx.jpg">'; $link_pdf['link_pdf'] = ''; // $image['link_pdf'] =route('file.get',['filename'=>$data->file()->get()[0]->filename]); } // $image = $data->file()->get()[0]->filename; // dd($image[0]->filename); // dd(); $data_ref['ref_jenis_sppd_id'] = Jenissppd::get()->toArray(); $data_ref['ref_skpd_id'] = Skpd::get()->toArray(); $data_ref['ref_unit_kerja_id'] = Unitkerja::get()->toArray(); $data_ref['ref_penerima_id'] = Penerima::get()->toArray(); $data_ref['ref_libur_nas'] = $this->daftar_libur_nasional(); // dd($data_ref['ref_jenis_sppd_id']); return $v_data + $link_pdf + ['token' => csrf_token()] + $data_ref; return __FUNCTION__; }