public static function update($ct, $anak = null) { $contact = ContactPerson::find($ct['id']); $contact = ContactPersonDAO::exchangeArray($contact, $ct); if (!is_null($anak)) { $contact->Anak()->associate($anak); } $contact->update(); return $contact; }
public function update() { $fm = Input::get('form'); $pel = Input::get('pelapor'); $an = Input::get('anak'); $ct = Input::get('contact'); $user = Auth::user(); $sign = ['penerima' => $user, 'pelapor' => $pel['nama']]; $sign = json_encode($sign); $fm['sign'] = $sign; //get no lka and tanggal for update $form = Form::find($fm['id']); $no_lka = $form->no_lka; // inject lka if not set if (!isset($fm['no_lka'])) { $fm['no_lka'] = $form->no_lka; } // inject tanggal if not set if (!isset($fm['tanggal'])) { $fm['tanggal'] = $form->tanggal; } $form = FormDAO::saveOrUpdate($fm); $anak = AnakDAO::saveOrUpdate($an); $pelapor = PelaporDAO::saveOrUpdate($pel, $anak); $ct = ContactPersonDAO::saveOrUpdate($ct, $anak); //notifikasi NotifikasiFormLKAHelper::updateNotif($form->id); Session::flash('message', "Form with No LKA {$no_lka} has been updated!"); return Redirect::to('dash/formka1'); }
public function update() { $fm = Input::get('form'); $pel = Input::get('pelapor'); $an = Input::get('anak'); $ct = Input::get('contact'); // inject tanggal if not set if (!isset($fm['tanggal'])) { $fm['tanggal'] = $fm['tanggal_old']; } $user = Auth::user(); $sign = ['penerima' => $user, 'pelapor' => $pel['nama']]; $sign = json_encode($sign); $fm['sign'] = $sign; $form = FormDAO::saveOrUpdate($fm); $anak = AnakDAO::saveOrUpdate($an); $pelapor = PelaporDAO::saveOrUpdate($pel, $anak); $ct = ContactPersonDAO::saveOrUpdate($ct, $anak); //synchornize multiple total and sequence multiview FormMultiHelper::synchronize($fm['no_lka']); //notifikasi NotifikasiFormLKAHelper::updateNotif($form->id); $lka = base64_encode($fm['no_lka']); Session::flash('message', "Form with No LKA {$form->no_lka} has been updated!"); return Redirect::to('dash/formka1multi/view/' . $lka); }