public function makeKey($keyLength = 9) { $key = Inflector::quickRandom($keyLength); $check = $this->exists($key); if (true === $check) { return $this->makeKey(); } return $key; }
public function getKeyLite($type, $keyLength = 9) { $table = $type . 's'; $db = static::lite($type); $key = Inflector::quickRandom($keyLength); $q = "SELECT id FROM {$table} WHERE id = '" . $key . "'"; $res = $db->query($q); if (false === $res->fetchArray()) { return $key; } else { return static::getKeyLite($type, $keyLength); } }