Esempio n. 1
0
 public function save($id = null)
 {
     if ($id) {
         $hobi = Hobi::find($id);
     } else {
         $hobi = new Hobi();
     }
     $rule = ['jenis' => 'required'];
     $this->validate($this->request, $rule);
     $input = $this->request->only('jenis');
     $hobi->jenis = $input['jenis'];
     $hobi->save();
     return redirect('hobi');
 }
Esempio n. 2
0
 public function form($id = null)
 {
     if (!is_null($id)) {
         $identitas = $this->identitas->findOrFail($id);
         $this->session->flashInput($identitas->toArray());
     }
     $provinsi = Provinsi::lists('nama', 'id');
     $kecamatan = Kecamatan::lists('nama', 'id');
     $hobi = Hobi::lists('jenis', 'id');
     $kota = Kota::lists('nama', 'id');
     return view('identitas.form', compact('kota', 'provinsi', 'kecamatan', 'hobi'));
 }