public function save($id = null)
 {
     if ($id) {
         $kecamatan = Kecamatan::find($id);
     } else {
         $kecamatan = new Kecamatan();
     }
     $rule = ['nama' => 'required', 'kota_id' => 'required'];
     $this->validate($this->request, $rule);
     $input = $this->request->only('nama', 'kota_id');
     $kecamatan->nama = $input['nama'];
     $kecamatan->kota_id = $input['kota_id'];
     $kecamatan->save();
     return redirect('kecamatan');
 }
 public function add()
 {
     $in = Input::all();
     print_r($in);
     $kk = KabKota::find($in['kabkota']);
     if (!is_null($kk->first())) {
         $kec = new Kecamatan();
         $kec->id = $this->getRandomIDs();
         $kec->nama = $in['kecamatan'];
         $kec->kabkota()->associate($kk);
         $kec->save();
         Session::flash('message', "Kecamatan {$kec->nama} Successfully Added");
         return Redirect::to('/dash/setting/kecamatan');
     } else {
         $kc = $in['kecamatan'];
         Session::flash('message', "Error, Kecamatan {$kc} Failed to Add!");
         return Redirect::to('/dash/setting/kecamatan');
     }
 }