/** * Check if contact exists, if not create a new user * @param string $type * @param string $id * @return collection */ public function getContact($type, $id) { if ($type == 'twitter' && Contact::where('twitter_id', $id)->exists()) { return Contact::findByTwitterId($id); } else { if ($type == 'facebook' && Contact::where('facebook_id', $id)->exists()) { return Contact::findByFbId($id); } } return new Contact(); }