Example #1
0
 public static function delete($id)
 {
     $contact = ContactPerson::find($id);
     if (!is_null($contact->first())) {
         return $contact->delete();
     } else {
         return false;
     }
 }
Example #2
0
 public static function contactSaveOrUpdate($ct, $anak)
 {
     $contact = null;
     if (empty($ct['id'])) {
         if (isset($ct['nama']) || isset($ct['telp'])) {
             $contact = new ContactPerson();
             $contact->nama = $ct['nama'];
             $contact->telp = $ct['telp'];
             $contact->anak()->associate($anak);
             $contact->save();
         }
     } else {
         $contact = ContactPerson::find($ct['id']);
         if (count($contact)) {
             $contact->nama = $ct['nama'];
             $contact->telp = $ct['telp'];
             $contact->update();
         }
     }
     return $contact;
 }