protected function getToken() { $token = str_random(24); while ($this->db->table('email_confirmations')->where('token', '=', $token)->exists()) { $token = str_random(25); } return $token; }