Ejemplo n.º 1
0
 public static function update($ms, $anak = null)
 {
     $masalah = IdentifikasiMasalah::find($ms['id']);
     $masalah = IdentifikasiMasalahDAO::exchangeArray($masalah, $ms);
     if (!is_null($anak)) {
         $masalah->Anak()->associate($anak);
     }
     $masalah->update();
     return $masalah;
 }
Ejemplo n.º 2
0
 public function delete($id)
 {
     //notifikasi
     FormKA4DisposisiHelper::deleteNotif($id);
     $fm = Form::find($id);
     $anakId = 64;
     $anak = Anak::find($anakId);
     $forms = $anak->form;
     //delete semua form yang berkaitan
     foreach ($forms as $form) {
         if ($form->nama == "ka4" || $form->nama == "ka5" || $form->nama == "ka6" || $form->nama == "ka7") {
             FormDAO::delete($form->id);
         }
     }
     //delete data pendampingan
     $pendamping = $anak->Pendampingan()->get();
     foreach ($pendamping as $pd) {
         PendampinganDAO::delete($pd->id);
     }
     $gf = $anak->GambaranFisik()->get();
     foreach ($gf as $val) {
         GambaranFisikDAO::delete($val->id);
     }
     $kp = $anak->KondisiPsikososial()->get();
     foreach ($kp as $val) {
         KondisiPsikososialDAO::delete($val->id);
     }
     $im = $anak->IdentifikasiMasalah()->get();
     foreach ($im as $val) {
         IdentifikasiMasalahDAO::delete($val->id);
     }
     $kel = $anak->Keluarga()->get();
     foreach ($kel as $val) {
         KeluargaDAO::delete($val->id);
     }
     if ($fm) {
         Session::flash('message', "Form with {$id} has been deleted!");
     } else {
         Session::flash('message', "Error, Form with {$id} not found!");
     }
     return Redirect::to('/dash/formka4');
 }