Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created May 9, 2014 17:39
Show Gist options
  • Save shadowhand/176866a74bfe25f568a0 to your computer and use it in GitHub Desktop.
Save shadowhand/176866a74bfe25f568a0 to your computer and use it in GitHub Desktop.
<?php
class Repository
{
const TABLE = 'contacts';
/* snip */
public function edit(Contact $contact)
{
$data = array_filter($contact->asArray());
unset($data['id']); // never update id
$query = DB::update(self::TABLE)
->set($data)
->where('id', '=', $contact->id)
;
$count = $query->execute();
return TRUE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment