Exemple #1
0
 public function makeKey($keyLength = 9)
 {
     $key = Inflector::quickRandom($keyLength);
     $check = $this->exists($key);
     if (true === $check) {
         return $this->makeKey();
     }
     return $key;
 }
Exemple #2
0
 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);
     }
 }