Validate that an attribute is different from another attribute.

@param  string  $attribute
@param  mixed   $value
@param  array   $parameters
@return bool
10001
public function validateDifferent($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'different');

        foreach ($parameters as $parameter) {
            if (! Arr::has($this->data, $parameter)) {
                return false;
            }

            $other = Arr::get($this->data, $parameter);

            if ($value === $other) {
                return false;
            }
        }

        return true;
    }
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;
	}
192478
protected function validateMimes($attribute, $value, $parameters)
    {
        if (! $this->isAValidFileInstance($value)) {
            return false;
        }

        return $value->getPath() != '' && in_array($value->guessExtension(), $parameters);
    }
1133050
protected function validateDate($attribute, $value)
    {
        if ($value instanceof DateTime) {
            return true;
        }

        if (strtotime($value) === false) {
            return false;
        }

        $date = date_parse($value);

        return checkdate($date['month'], $date['day'], $date['year']);
    }
1364971
protected function validateDimensions( $attribute, $value, $parameters )
	{
		if ( !$this->isAValidFileInstance( $value ) || !$sizeDetails = getimagesize( $value->getRealPath() ) )
		{
			return false;
		}

		$this->requireParameterCount( 1, $parameters, 'dimensions' );

		list( $width, $height ) = $sizeDetails;

		$parameters = $this->parseNamedParameters( $parameters );

		if ( isset( $parameters['width'] ) && $parameters['width'] != $width || isset( $parameters['min_width'] ) && $parameters['min_width'] > $width || isset( $parameters['max_width'] ) && $parameters['max_width'] < $width || isset( $parameters['height'] ) && $parameters['height'] != $height || isset( $parameters['min_height'] ) && $parameters['min_height'] > $height || isset( $parameters['max_height'] ) && $parameters['max_height'] < $height )
		{
			return false;
		}

		if ( isset( $parameters['ratio'] ) )
		{
			list( $numerator, $denominator ) = array_pad( sscanf( $parameters['ratio'], '%d/%d' ), 2, 1 );

			return $numerator / $denominator == $width / $height;
		}

		return true;
	}
1073461
public function validateBefore($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'before');

        return $this->compareDates($attribute, $value, $parameters, '<');
    }
532612
public function validateMimes($attribute, $value, $parameters)
    {
        if (! $this->isValidFileInstance($value)) {
            return false;
        }

        if ($this->shouldBlockPhpUpload($value, $parameters)) {
            return false;
        }

        return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters);
    }
842320
protected function validateBic($attribute, $value, $parameters)
    {
        // Use provided regex or use fallback
        $pattern = ! empty($parameters[0]) ? $parameters[0] : '/^[A-Za-z]{4,} ?[A-Za-z]{2,} ?[A-Za-z0-9]{2,} ?([A-Za-z0-9]{3,})?$/';

        return (bool) preg_match($pattern, $value);
    }
758943
protected function validateSame($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'same');

        $other = Arr::get($this->data, $parameters[0]);

        return (isset($other) && $value == $other);
    }
1345915
public function validate($attribute, $value, $parameters, $validator)
    {
        list ($name, $locale) = $this->getAttributeNameAndLocale($attribute);

        if ($this->isUnique($value, $name, $locale, $parameters)) {
            return true;
        }

        $this->addErrorsToValidator($validator, $parameters, $name, $locale);

        return false;
    }
90778
protected function validateMimes($attribute, $value, $parameters)
    {
        if (!in_array($value, $_FILES, true)) {
            return false;
        }

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

        // The Symfony File class should do a decent job of guessing the extension
        // based on the true MIME type so we'll just loop through the array of
        // extensions and compare it to the guessed extension of the files.
        if ($value['tmp_name'] !== '') {
            return in_array(pathinfo($value['name'], PATHINFO_EXTENSION), $parameters, true);
        } else {
            return false;
        }
    }
696242
public function validateDateEquals($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'date_equals');

        return $this->compareDates($attribute, $value, $parameters, '=');
    }
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 ) );
	}
296836
protected function validate($attribute, $value)
    {
        $properties = array_merge($this->baseProperties, $this->properties);

        return in_array($attribute, $properties, true);
    }
1275972
protected function validateExists($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'exists');

        list($connection, $table) = $this->parseTable($parameters[0]);

        // The second parameter position holds the name of the column that should be
        // verified as existing. If this parameter is not specified we will guess
        // that the columns being "verified" shares the given attribute's name.
        $column = isset($parameters[1]) ? $parameters[1] : $attribute;

        $expected = (is_array($value)) ? count($value) : 1;

        return $this->getExistCount($connection, $table, $column, $value, $parameters) >= $expected;
    }
1120987
protected function validateRequiredIf( $attribute, $value, $parameters )
	{
		$this->requireParameterCount( 2, $parameters, 'required_if' );

		$data = Arr::get( $this->data, $parameters[0] );

		$values = array_slice( $parameters, 1 );

		if ( is_bool( $data ) )
		{
			array_walk( $values, function ( &$value )
			{
				if ( $value === 'true' )
				{
					$value = true;
				}
				elseif ( $value === 'false' )
				{
					$value = false;
				}
			} );
		}

		if ( in_array( $data, $values ) )
		{
			return $this->validateRequired( $attribute, $value );
		}

		return true;
	}
1141145
public function validateExists($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'exists');

        [$connection, $table] = $this->parseTable($parameters[0]);

        // The second parameter position holds the name of the column that should be
        // verified as existing. If this parameter is not specified we will guess
        // that the columns being "verified" shares the given attribute's name.
        $column = $this->getQueryColumn($parameters, $attribute);

        $expected = is_array($value) ? count(array_unique($value)) : 1;

        return $this->getExistCount(
            $connection, $table, $column, $value, $parameters
        ) >= $expected;
    }