public function saveContact(contact $contact)
    {
        $contact->save();
        foreach ($this->contacts as $k => $contactdb) {
            if ($contactdb->id == $contact->id) {
                $this->contacts[$k] = $contact;

                return;
            }
        }
        $this->contacts[] = $contact;
    }
public function saveContact(contact $contact)
    {
        $contact->save();
        foreach ($this->contacts as $k => $contactdb) {
            if ($contactdb->id == $contact->id) {
                $this->contacts[$k] = $contact;

                return;
            }
        }
        $this->contacts[] = $contact;
    }
public function saveContact ( contact $ contact ) { $ contact -> save ( ) ; foreach ( $ this -> contacts as $ k => $ contactdb ) { if ( $ contactdb -> id == $ contact -> id ) { $ this -> contacts [ $ k ] = $ contact ; return ; } } $ this -> contacts [ ] = $ contact ; }
Saves a given contact.

@param contact
@return void
Saves a given contact .