-
-
Save isaiahdw/247923 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
class Contact_Model extends Model | |
{ | |
public function read_contact($contact_id) | |
{ | |
if(is_numeric($contact_id)) | |
{ | |
$query = ORM::factory('contact', $contact_id)->find(); | |
} | |
else throw new Exception('Not a valid contact ID'); | |
if($query->loaded) | |
{ | |
return $query; | |
} | |
else throw new Exception('Contact not found.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment