public function handle(FormRequest $request)
    {
        try{

            $form = $this->resolve();

            // validate request
            $request->validate($form->fields);

            $form->request = $request;

            // fire callbacks
            $this->kernel->fireEvent($form);

            // return success
            return true;

        } catch(FormException $e){

            // form validation errors
            $this->kernel->setErrors($this->form, $e->getErrors()->messages());

            // return failure
            return false;

        } catch(QueryException $e){

            // database errors
            //todo log exception
            throw new HttpException(500, $e->getMessage());
            //throw new HttpException(500, "Database error.");

        } catch(\Exception $e){

            // general exceptions
            //todo log exception
            throw new HttpException(500, $e->getMessage());

        }
    }
public function handle(FormRequest $request)
    {
        try{

            $form = $this->resolve();

            // validate request
            $request->validate($form->fields);

            $form->request = $request;

            // fire callbacks
            $this->kernel->fireEvent($form);

            // return success
            return true;

        } catch(FormException $e){

            // form validation errors
            $this->kernel->setErrors($this->form, $e->getErrors()->messages());

            // return failure
            return false;

        } catch(QueryException $e){

            // database errors
            //todo log exception
            throw new HttpException(500, $e->getMessage());
            //throw new HttpException(500, "Database error.");

        } catch(\Exception $e){

            // general exceptions
            //todo log exception
            throw new HttpException(500, $e->getMessage());

        }
    }
public function handle ( FormRequest $ request ) { try { $ form = $ this -> resolve ( ) ; // validate request $ request -> validate ( $ form -> fields ) ; $ form -> request = $ request ; // fire callbacks $ this -> kernel -> fireEvent ( $ form ) ; // return success return true ; } catch ( FormException $ e ) { // form validation errors $ this -> kernel -> setErrors ( $ this -> form , $ e -> getErrors ( ) -> messages ( ) ) ; // return failure return false ; } catch ( QueryException $ e ) { // database errors //todo log exception throw new HttpException ( 500 , $ e -> getMessage ( ) ) ; //throw new HttpException(500, "Database error."); } catch ( \ Exception $ e ) { // general exceptions //todo log exception throw new HttpException ( 500 , $ e -> getMessage ( ) ) ; } }
Handle form form submission

@param FormRequest $request
@return mixed
Handle form form submission