protected function getNormalizedFormFieldErrors()
    {
        $viewBags = session('errors');

        if ( ! ($viewBags instanceof ViewErrorBag) || ! count($viewBags)) {
            return [];
        }

        /** @var MessageBag $errorBag */
        $errorBag = head($viewBags->getBags());

        if ( ! $errorBag->any()) {
            return [];
        }

        $normalized = [];

        foreach ($errorBag->toArray() as $field => $errors) {
            array_set($normalized, $field, $errors);
        }

        return $normalized;
    }
protected function getNormalizedFormFieldErrors()
    {
        $viewBags = session('errors');

        if ( ! ($viewBags instanceof ViewErrorBag) || ! count($viewBags)) {
            return [];
        }

        /** @var MessageBag $errorBag */
        $errorBag = head($viewBags->getBags());

        if ( ! $errorBag->any()) {
            return [];
        }

        $normalized = [];

        foreach ($errorBag->toArray() as $field => $errors) {
            array_set($normalized, $field, $errors);
        }

        return $normalized;
    }
protected function getNormalizedFormFieldErrors ( ) { $ viewBags = session ( 'errors' ) ; if ( ! ( $ viewBags instanceof ViewErrorBag ) || ! count ( $ viewBags ) ) { return [ ] ; } /** @var MessageBag $errorBag */ $ errorBag = head ( $ viewBags -> getBags ( ) ) ; if ( ! $ errorBag -> any ( ) ) { return [ ] ; } $ normalized = [ ] ; foreach ( $ errorBag -> toArray ( ) as $ field => $ errors ) { array_set ( $ normalized , $ field , $ errors ) ; } return $ normalized ; }
Returns associative array with form validation errors, keyed by field keys.

This normalizes the errors to a nested structure that may be handled for display
by form field strategies.

@return array
Returns associative array with form validation errors keyed by field keys .