src/Leevel/Validate/UniqueRule.php
public function validate($value, array $parameter, IValidator $validator, string $field): bool
    {
        if (!array_key_exists(0, $parameter)) {
            throw new InvalidArgumentException('Missing the first element of parameter.');
        }

        if (!is_string($parameter[0]) && !is_object($parameter[0])) {
            return false;
        }

        $select = $this->normalizeSelect($value, $parameter, $field);

        $this->parseExceptId($select, $parameter);
        $this->parseAdditional($select, $parameter);

        return 0 === $select->findCount();
    }
public function validate($value, array $parameter, IValidator $validator, string $field): bool
    {
        if (!array_key_exists(0, $parameter)) {
            throw new InvalidArgumentException('Missing the first element of parameter.');
        }

        if (!is_string($parameter[0]) && !is_object($parameter[0])) {
            return false;
        }

        $select = $this->normalizeSelect($value, $parameter, $field);

        $this->parseExceptId($select, $parameter);
        $this->parseAdditional($select, $parameter);

        return 0 === $select->findCount();
    }
校验.

@param mixed                       $value
@param array                       $parameter
@param \Leevel\Validate\IValidator $validator
@param string                      $field

@return bool