public static function update($sum, $anak = null) { $sb = SumberInformasi::find($sum['id']); $sb = SumberInformasiDAO::exchangeArray($sb, $sum); $sb->update(); if (!is_null($anak)) { $sb->Anak()->attach($anak->id); } return $sb; }
public function update() { $fm = Input::get('form'); $sum = Input::get('sumber'); $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, 'sumber' => $sum['sumber']]; $sign = json_encode($sign); $fm['sign'] = $sign; $form = FormDAO::saveOrUpdate($fm); $anak = AnakDAO::saveOrUpdate($an); SumberInformasiDAO::saveOrUpdate($sum, $anak); 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/formka2multi/view/' . $lka); }
public function update() { $fm = Input::get('form'); $sum = Input::get('sumber'); $an = Input::get('anak'); $ct = Input::get('contact'); //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; } $user = Auth::user(); $sign = ['penerima' => $user]; $sign = json_encode($sign); $fm['sign'] = $sign; FormDAO::saveOrUpdate($fm); $anak = AnakDAO::saveOrUpdate($an); SumberInformasiDAO::saveOrUpdate($sum, $anak); ContactPersonDAO::saveOrUpdate($ct, $anak); $lka = $fm['no_lka']; //notifikasi NotifikasiFormLKAHelper::updateNotif($form->id); Session::flash('message', "Form with No LKA {$lka} has been updated!"); return Redirect::to('dash/formka2'); }