From 124f7cad284d7ce867666def5731ad34a9265e63 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 13 Feb 2015 16:41:50 -0500 Subject: Check if the user session match an existing user --- app/Model/User.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/Model/User.php') diff --git a/app/Model/User.php b/app/Model/User.php index 01be8597..7586f3c4 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -28,6 +28,18 @@ class User extends Base */ const EVERYBODY_ID = -1; + /** + * Return true if the user exists + * + * @access public + * @param integer $user_id User id + * @return boolean + */ + public function exists($user_id) + { + return $this->db->table(self::TABLE)->eq('id', $user_id)->count() === 1; + } + /** * Get query to fetch all users * -- cgit v1.2.3