public static function update($pen, $anak = null)
 {
     $pd = Pendampingan::find($pen['id']);
     $pd = PendampinganDAO::exchangeArray($pd, $pen);
     if (!is_null($anak)) {
         $pd->Anak()->associate($anak);
     }
     $pd->update();
     return $pd;
 }
 public function delete($id)
 {
     $pen = Pendampingan::find($id);
     $anak = $pen->anak;
     $del = PendampinganDAO::delete($id);
     if ($del) {
         Session::flash('message', "Pendampingan with tanggal {$pen->tanggal} has been deleted!");
     } else {
         Session::flash('message', "Error, Pendampingan with {$id} not found!");
     }
     return Redirect::to('/dash/formka6/pendampingan/view/' . $anak->id);
 }
 public function delete($id)
 {
     //notifikasi
     NotifikasiDisposisiHelper::formDelete($id);
     $fm = Form::find($id);
     $anak = $fm->anak->first();
     $forms = $anak->form;
     //delete semua form yang berkaitan
     foreach ($forms as $form) {
         if ($form->nama == "ka3" || $form->nama == "ka4" || $form->nama == "ka5" || $form->nama == "ka6" || $form->nama == "ka7") {
             FormDAO::delete($form->id);
         }
     }
     //delete data pendampingan
     $pendamping = $anak->pendampingan;
     foreach ($pendamping as $pd) {
         PendampinganDAO::delete($pd->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/formka3');
 }
 public function delete($id)
 {
     //notifikasi
     NotifikasiFormLKAHelper::deleteNotif($id);
     $fm = Form::find($id);
     $anak = $fm->anak->first();
     $forms = $anak->form;
     //delete semua form yang berkaitan
     foreach ($forms as $form) {
         FormDAO::delete($form->id);
     }
     $pendampingan = $anak->pendampingan;
     if ($pendampingan) {
         foreach ($pendampingan as $pen) {
             PendampinganDAO::delete($pen->id);
         }
     }
     $files = $anak->files;
     if ($files) {
         foreach ($files as $fl) {
             FilesDAO::delete($fl->id);
         }
     }
     $pelapor = $anak->pelapor->first();
     if ($pelapor) {
         $pelapor->delete();
     }
     $keluarga = $anak->keluarga;
     if ($keluarga) {
         $keluarga->delete();
     }
     $fisik = $anak->gambaran_fisik;
     if ($fisik) {
         $fisik->delete();
     }
     $identifikasi = $anak->identifikasi_masalah;
     if ($identifikasi) {
         $identifikasi->delete();
     }
     $psiko = $anak->kondisi_psikososial;
     if ($psiko) {
         $psiko->delete();
     }
     $contact = $anak->contact_person;
     if ($contact) {
         $contact->delete();
     }
     $jenis = $anak->jenis_kasus;
     if ($jenis) {
         foreach ($jenis as $jn) {
             if ($jn->other == "T") {
                 JenisKasusDAO::delete($jn->id);
             }
         }
     }
     //delete data anak
     AnakDAO::delete($anak->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/formka1');
 }
Exemple #5
0
 public function delete($id)
 {
     $anak = Anak::find($id);
     $form = $anak->form;
     foreach ($form as $fm) {
         FormDAO::delete($fm->id);
     }
     $pendampingan = $anak->pendampingan;
     if ($pendampingan) {
         foreach ($pendampingan as $pen) {
             PendampinganDAO::delete($pen->id);
         }
     }
     $files = $anak->files;
     if ($files) {
         foreach ($files as $fl) {
             FilesDAO::delete($fl->id);
         }
     }
     $pelapor = $anak->pelapor->first();
     if ($pelapor) {
         $pelapor->delete();
     }
     $sumber = $anak->sumber_informasi->first();
     if ($sumber) {
         $sumber->delete();
     }
     $keluarga = $anak->keluarga;
     if ($keluarga) {
         $keluarga->delete();
     }
     $fisik = $anak->gambaran_fisik;
     if ($fisik) {
         $fisik->delete();
     }
     $identifikasi = $anak->identifikasi_masalah;
     if ($identifikasi) {
         $identifikasi->delete();
     }
     $psiko = $anak->kondisi_psikososial;
     if ($psiko) {
         $psiko->delete();
     }
     $contact = $anak->contact_person;
     if ($contact) {
         $contact->delete();
     }
     $jenis = $anak->jenis_kasus;
     foreach ($jenis as $jn) {
         if ($jn->other == "T") {
             JenisKasusDAO::delete($jn->id);
         }
     }
     $nama_anak = $anak->nama;
     $anak->delete();
     if ($anak) {
         Session::flash('message', "Anak dengan Nama {$nama_anak} been deleted!");
     } else {
         Session::flash('message', "Error, Anak dengan Nama {$nama_anak} tidak ditemukan!");
     }
     return Redirect::to('/dash/anak');
 }
 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');
 }