protected function resolveErrorKey($messages = [])
	{
		// if there is no error key defined leave messages as they were
		if(empty($this->errorKey))
		{
			return $messages;
		}

		// keys are divided on every .
		$keys = explode('.', $this->errorKey);

		// we need to reverse this array for sorting
		$keys = array_reverse($keys);

		foreach ($keys as $errorKey) {
			$messages = array($errorKey => $messages);
		}

		return $messages;
	}
protected function resolveErrorKey($messages = [])
	{
		// if there is no error key defined leave messages as they were
		if(empty($this->errorKey))
		{
			return $messages;
		}

		// keys are divided on every .
		$keys = explode('.', $this->errorKey);

		// we need to reverse this array for sorting
		$keys = array_reverse($keys);

		foreach ($keys as $errorKey) {
			$messages = array($errorKey => $messages);
		}

		return $messages;
	}
protected function resolveErrorKey ( $ messages = [ ] ) { // if there is no error key defined leave messages as they were if ( empty ( $ this -> errorKey ) ) { return $ messages ; } // keys are divided on every . $ keys = explode ( '.' , $ this -> errorKey ) ; // we need to reverse this array for sorting $ keys = array_reverse ( $ keys ) ; foreach ( $ keys as $ errorKey ) { $ messages = array ( $ errorKey => $ messages ) ; } return $ messages ; }
Nest messages according to error key

@param array $messages

@return array
Nest messages according to error key