public function redirectIfNotValid($destination = null)
    {
        if (! $this->isValid()) {
            $response = redirect($destination);

            if (is_null($destination)) {
                $response = $response->back();
            }

            $response = $response->withErrors($this->getErrors(), $this->getErrorBag())->withInput();

            throw new HttpResponseException($response);
        }
    }
public function redirectIfNotValid($destination = null)
    {
        if (! $this->isValid()) {
            $response = redirect($destination);

            if (is_null($destination)) {
                $response = $response->back();
            }

            $response = $response->withErrors($this->getErrors(), $this->getErrorBag())->withInput();

            throw new HttpResponseException($response);
        }
    }
public function redirectIfNotValid ( $ destination = null ) { if ( ! $ this -> isValid ( ) ) { $ response = redirect ( $ destination ) ; if ( is_null ( $ destination ) ) { $ response = $ response -> back ( ) ; } $ response = $ response -> withErrors ( $ this -> getErrors ( ) , $ this -> getErrorBag ( ) ) -> withInput ( ) ; throw new HttpResponseException ( $ response ) ; } }
Redirects to a destination when form is invalid.

@param  string|null $destination The target url.
@return HttpResponseException
Redirects to a destination when form is invalid .