public function withErrors($validator)
    {
        foreach ($validator->errors() as $key => $value) {
            if (count($value) > 1) {
                for ($i = 0; $i < count($value); $i++) {
                    $data[$key][$i] = $value[$i];
                }
            } else {
                $data[$key] = $value[0];
            }
            $this->_errors->add((object) $data);
        }

        $this->_session->flash('errors', $this->_errors->all());

        return $this;
    }
public function withErrors($validator)
    {
        foreach ($validator->errors() as $key => $value) {
            if (count($value) > 1) {
                for ($i = 0; $i < count($value); $i++) {
                    $data[$key][$i] = $value[$i];
                }
            } else {
                $data[$key] = $value[0];
            }
            $this->_errors->add((object) $data);
        }

        $this->_session->flash('errors', $this->_errors->all());

        return $this;
    }
public function withErrors ( $ validator ) { foreach ( $ validator -> errors ( ) as $ key => $ value ) { if ( count ( $ value ) > 1 ) { for ( $ i = 0 ; $ i < count ( $ value ) ; $ i ++ ) { $ data [ $ key ] [ $ i ] = $ value [ $ i ] ; } } else { $ data [ $ key ] = $ value [ 0 ] ; } $ this -> _errors -> add ( ( object ) $ data ) ; } $ this -> _session -> flash ( 'errors' , $ this -> _errors -> all ( ) ) ; return $ this ; }
Flash errors grabbed from a request.

@param \Scara\Validation\Validator $validator - Validation object

@return \Scara\Http\Controller
Flash errors grabbed from a request .