public function getProcessedErrors()
    {
        $errors = [];

        foreach ($this->errors as $error) {
            // Process replacements
            $message = ArrDots::get($this->messages['custom'], $error['attribute'])
                       ?? ArrDots::get($this->messages['rules'], $error['rule']);
            foreach ($error['replacements'] as $search => $replace) {
                switch ($search[0]) {
                    case ':':
                        $message = str_replace($search, Str::prettyAttribute($replace), $message);
                        break;
                    case '!':
                        if (!$replace) {
                            break;
                        }
                        // Check if the attribute is singular (use group 1) or plural (use group 2)
                        // Group 2 if plural, group 1 if singular
                        $replace = substr($error['replacements'][':attribute'] ?? '', -1, 1) !== static::WILD
                            ? '$1' : '$2';
                        $message = preg_replace("/$search/", $replace, $message);
                        break;

                    case '%':
                    default:
                        $message = str_replace($search, $replace, $message);
                        break;
                }
            }
            $errors[$error['attribute']][$error['rule']] = $message;
        }

        return ['errors' => $errors];
    }
public function getProcessedErrors()
    {
        $errors = [];

        foreach ($this->errors as $error) {
            // Process replacements
            $message = ArrDots::get($this->messages['custom'], $error['attribute'])
                       ?? ArrDots::get($this->messages['rules'], $error['rule']);
            foreach ($error['replacements'] as $search => $replace) {
                switch ($search[0]) {
                    case ':':
                        $message = str_replace($search, Str::prettyAttribute($replace), $message);
                        break;
                    case '!':
                        if (!$replace) {
                            break;
                        }
                        // Check if the attribute is singular (use group 1) or plural (use group 2)
                        // Group 2 if plural, group 1 if singular
                        $replace = substr($error['replacements'][':attribute'] ?? '', -1, 1) !== static::WILD
                            ? '$1' : '$2';
                        $message = preg_replace("/$search/", $replace, $message);
                        break;

                    case '%':
                    default:
                        $message = str_replace($search, $replace, $message);
                        break;
                }
            }
            $errors[$error['attribute']][$error['rule']] = $message;
        }

        return ['errors' => $errors];
    }
public function getProcessedErrors ( ) { $ errors = [ ] ; foreach ( $ this -> errors as $ error ) { // Process replacements $ message = ArrDots :: get ( $ this -> messages [ 'custom' ] , $ error [ 'attribute' ] ) ?? ArrDots :: get ( $ this -> messages [ 'rules' ] , $ error [ 'rule' ] ) ; foreach ( $ error [ 'replacements' ] as $ search => $ replace ) { switch ( $ search [ 0 ] ) { case ':' : $ message = str_replace ( $ search , Str :: prettyAttribute ( $ replace ) , $ message ) ; break ; case '!' : if ( ! $ replace ) { break ; } // Check if the attribute is singular (use group 1) or plural (use group 2) // Group 2 if plural, group 1 if singular $ replace = substr ( $ error [ 'replacements' ] [ ':attribute' ] ?? '' , - 1 , 1 ) !== static :: WILD ? '$1' : '$2' ; $ message = preg_replace ( "/$search/" , $ replace , $ message ) ; break ; case '%' : default : $ message = str_replace ( $ search , $ replace , $ message ) ; break ; } } $ errors [ $ error [ 'attribute' ] ] [ $ error [ 'rule' ] ] = $ message ; } return [ 'errors' => $ errors ] ; }
Return a processed array of errors.

@return array
Return a processed array of errors .