protected function getErrorMessage(string $rule, string $field, string $label = null, string $param = null): string
	{
		// Check if custom message has been defined by user
		if (isset($this->customErrors[$field][$rule]))
		{
			$message = $this->customErrors[$field][$rule];
		}
		else
		{
			// Try to grab a localized version of the message...
			// lang() will return the rule name back if not found,
			// so there will always be a string being returned.
			$message = lang('Validation.' . $rule);
		}

		$message = str_replace('{field}', $label ?? $field, $message);
		$message = str_replace('{param}', $this->rules[$param]['label'] ?? $param, $message);

		return $message;
	}
protected function getErrorMessage(string $rule, string $field, string $label = null, string $param = null): string
	{
		// Check if custom message has been defined by user
		if (isset($this->customErrors[$field][$rule]))
		{
			$message = $this->customErrors[$field][$rule];
		}
		else
		{
			// Try to grab a localized version of the message...
			// lang() will return the rule name back if not found,
			// so there will always be a string being returned.
			$message = lang('Validation.' . $rule);
		}

		$message = str_replace('{field}', $label ?? $field, $message);
		$message = str_replace('{param}', $this->rules[$param]['label'] ?? $param, $message);

		return $message;
	}
protected function getErrorMessage ( string $ rule , string $ field , string $ label = null , string $ param = null ) : string { // Check if custom message has been defined by user if ( isset ( $ this -> customErrors [ $ field ] [ $ rule ] ) ) { $ message = $ this -> customErrors [ $ field ] [ $ rule ] ; } else { // Try to grab a localized version of the message... // lang() will return the rule name back if not found, // so there will always be a string being returned. $ message = lang ( 'Validation.' . $ rule ) ; } $ message = str_replace ( '{field}' , $ label ?? $ field , $ message ) ; $ message = str_replace ( '{param}' , $ this -> rules [ $ param ] [ 'label' ] ?? $ param , $ message ) ; return $ message ; }
Attempts to find the appropriate error message

@param string      $rule
@param string      $field
@param string|null $label
@param string      $param

@return string
Attempts to find the appropriate error message