/** * 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__; }
public function anyCombobox(Request $req) { // dd($req->get('id')); if ($req->get('id')) { return Unitkerja::where('skpd_id', $req->get('id'))->orderBy('nama_unit_kerja', 'desc')->get(); } $data = Unitkerja::orderBy('nama_unit_kerja', 'desc')->get(); return $data; }
public function anyData() { $data = Unitkerja::all(); return $data; // }