Validate the size of an attribute is less than a maximum value.

@param string $attribute
@param mixed  $value
@param array  $parameters

@return bool
327795
protected function validateMax($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'max');

        if (!empty($value['tmp_name']) && is_uploaded_file($value['tmp_name']) && $value['error']) {
            return false;
        }

        return $this->getSize($attribute, $value) <= $parameters[0];
    }
535016
public function validateNameOnCreate($attribute, $value, $parameters)
    {
        $groupId = Input::get('group');
        $typeId  = Input::get('type');
        $exists  = Foundation::make('antares.customfields.model.view')
                ->query()
                ->where('group_id', $groupId)
                ->where('type_id', $typeId)
                ->where('name', $value)
                ->exists();
        if ($exists) {
            $this->setCustomMessages(['name-on-create' => trans('antares/customfields::validator.create.name-non-unique')]);
            $this->addFailure($attribute, 'name-on-create', []);
            return false;
        }


        return true;
    }
279033
public function passes($attribute, $value, $parameters, $validator)
    {
        return Str::is(Str::lower($parameters[0]), Str::lower(parse_url($value, PHP_URL_PATH)));
    }
202078
protected function validateUnique( $attribute, $value, $parameters )
	{
		$this->requireParameterCount( 1, $parameters, 'unique' );

		list( $connection, $table ) = $this->parseTable( $parameters[0] );
		// The second parameter position holds the name of the column that needs to
		// be verified as unique. If this parameter isn't specified we will just
		// assume that this column to be verified shares the attribute's name.
		$column = isset( $parameters[1] ) ? $parameters[1] : $this->guessColumnForQuery( $attribute );

		list( $idColumn, $id ) = [null, null];

		if ( isset( $parameters[2] ) )
		{
			list( $idColumn, $id ) = $this->getUniqueIds( $parameters );

			if ( preg_match( '/\[(.*)\]/', $id, $matches ) )
			{
				$id = $this->getValue( $matches[1] );
			}

			if ( strtolower( $id ) == 'null' )
			{
				$id = null;
			}

			if ( filter_var( $id, FILTER_VALIDATE_INT ) !== false )
			{
				$id = intval( $id );
			}
		}

		// The presence verifier is responsible for counting rows within this store
		// mechanism which might be a relational database or any other permanent
		// data store like Redis, etc. We will use it to determine uniqueness.
		$verifier = $this->getPresenceVerifier();

		$verifier->setConnection( $connection );

		$extra = $this->getUniqueExtra( $parameters );

		return $verifier->getCount( $table, $column, $value, $id, $idColumn, $extra

		) == 0;
	}
523627
protected function validateUsername($attribute, $value, $parameters)
    {
        // Use provided regex or use fallback
        $pattern = ! empty($parameters[0]) ? $parameters[0] : '/^([a-zA-Z0-9._-])+$/i';

        return (bool) preg_match($pattern, $value);
    }
928559
public function validateDateFormat($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'date_format');

        if (! is_string($value) && ! is_numeric($value)) {
            return false;
        }

        $format = $parameters[0];

        $date = DateTime::createFromFormat('!'.$format, $value);

        return $date && $date->format($format) == $value;
    }
783170
public function isSize($value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'size');

        return $this->getSize($value) == $parameters[0];
    }
373569
public function validateValidatorList($attribute, $value, $parameters)
    {
        $validators = Input::get('validators');
        if (!is_null($validators)) {
            foreach ($validators as $index => $id) {
                if (isset($value[$id]) && $value[$id] == '') {
                    $this->setCustomMessages(["validator_custom[{$id}]" => trans('antares/customfields::validator.create.validators-empty-fields')]);
                    $this->addFailure("validator_custom[{$id}]", "validator_custom[{$id}]", []);
                    break;
                }
            }
        }

        return true;
    }
1155221
protected function validateDateFormat($attribute, $value, $parameters)
	{
		$parsed = date_parse_from_format($parameters[0], $value);

		return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
	}
505852
protected function validateBefore($attribute, $value, $parameters)
	{
		if ( ! ($date = strtotime($parameters[0])))
		{
			return strtotime($value) < strtotime($this->getValue($parameters[0]));
		}
		else
		{
			return strtotime($value) < $date;
		}
	}
29518
public function isBetween($value, $parameters)
    {
        $this->requireParameterCount(2, $parameters, 'between');
        $size = $this->getSize($value);

        return $size >= $parameters[0] && $size <= $parameters[1];
    }
687301
public function validateInArray($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'in_array');

        $explicitPath = ValidationData::getLeadingExplicitAttributePath($parameters[0]);

        $attributeData = ValidationData::extractDataFromPath($explicitPath, $this->data);

        $otherValues = Arr::where(Arr::dot($attributeData), function ($value, $key) use ($parameters) {
            return Str::is($parameters[0], $key);
        });

        return in_array($value, $otherValues);
    }
360369
protected function validateIsbn($attribute, $value, $parameters)
    {
        // Prepare value for validation
        $value = str_replace([' ', '-', '‐', '.'], '', $value);

        // Length of value
        $length = strlen($value);

        // Validate either ISBN10 or ISBN13
        if ($length == 10) {
            return $this->validateIsbn10($attribute, $value, $parameters);
        } elseif ($length == 13) {
            return $this->validateIsbn13($attribute, $value, $parameters);
        }

        return false;
    }
695137
protected function validateDistinct( $attribute, $value, $parameters )
	{
		$attributeName = $this->getPrimaryAttribute( $attribute );

		$explicitPath = $this->getLeadingExplicitAttributePath( $attributeName );

		$attributeData = $this->extractDataFromPath( $explicitPath );

		$data = Arr::where( Arr::dot( $attributeData ), function ( $key ) use ( $attribute, $attributeName )
		{
			return $key != $attribute && Str::is( $attributeName, $key );
		} );

		return !in_array( $value, array_values( $data ) );
	}
134283
protected function validateIsbn13($attribute, $value, $parameters)
    {
        // Prepare value for validation
        $value = str_replace([' ', '-', '‐', '.'], '', $value);

        // Make sure value is exactly 13 characters
        // and that all the characters are numeric
        if (strlen($value) != 13 || ! is_numeric($value)) {
            return false;
        }

        // Grab "check digit" for later use
        $checkDigit = substr($value, -1);

        // Generate checksum
        $sum = $value[0] + ($value[1] * 3) + $value[2] + ($value[3] * 3) +
                $value[4] + ($value[5] * 3) + $value[6] + ($value[7] * 3) +
                $value[8] + ($value[9] * 3) + $value[10] + ($value[11] * 3);

        // Grab "check digit" from checksum for later verification
        $checksumCheckDigit = 10 - ($sum % 10);
        $checksumCheckDigit = ($checksumCheckDigit == 10) ? 0 : $checksumCheckDigit;

        return $checkDigit == $checksumCheckDigit;
    }
733904
protected function _validate_max($value, $parameters)
    {
        /** @noinspection CallableParameterUseCaseInTypeContextInspection */
        $value = $this->_validate_float($value);

        return $value === null || $value > $parameters[0] ? null : $value;
    }
296836
protected function validate($attribute, $value)
    {
        $properties = array_merge($this->baseProperties, $this->properties);

        return in_array($attribute, $properties, true);
    }