Created
May 9, 2014 17:39
-
-
Save shadowhand/176866a74bfe25f568a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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