public function submission($formData)
    {
        if ($form_settings = $this->_block->getContent(true)) {
            $form_settings = $this->_defaultData($form_settings);
            $form_rules = BlockFormRule::get_rules($form_settings->template ?: $this->_block->name);
            $v = Validator::make($formData, $form_rules);
            $captcha = Securimage::captchaCheck();

            // check form rules
            if ($v->passes() && !($form_settings->captcha && !$captcha)) {
                // delete blank and system fields
                unset($formData['captcha_code']);

                // Save data function (override this function to save data differently)
                $form_submission = $this->submissionSaveData($formData);
                if (!$form_submission->id) {
                    FormMessage::add('submission_save_error', 'Unable to save the form.');
                }

                // Send email
                if ($this->submissionSendEmail(unserialize($form_submission->content), $form_settings)) {
                    $form_submission->sent = 1;
                    $form_submission->save();
                }

                Session::put('form_data', $form_submission);
                return \redirect(PageBuilder::pageUrl($form_settings->page_to));
            } else {
                FormMessage::set($v->messages());
                if (!$captcha && $form_settings->captcha) {
                    FormMessage::add('captcha_code', 'Invalid Captcha Code, try again.');
                }
            }

        } else {
            return Response::make('No form settings found, try saving the form block in the admin.', 500);
        }

        return false;
    }
public function submission($formData)
    {
        if ($form_settings = $this->_block->getContent(true)) {
            $form_settings = $this->_defaultData($form_settings);
            $form_rules = BlockFormRule::get_rules($form_settings->template ?: $this->_block->name);
            $v = Validator::make($formData, $form_rules);
            $captcha = Securimage::captchaCheck();

            // check form rules
            if ($v->passes() && !($form_settings->captcha && !$captcha)) {
                // delete blank and system fields
                unset($formData['captcha_code']);

                // Save data function (override this function to save data differently)
                $form_submission = $this->submissionSaveData($formData);
                if (!$form_submission->id) {
                    FormMessage::add('submission_save_error', 'Unable to save the form.');
                }

                // Send email
                if ($this->submissionSendEmail(unserialize($form_submission->content), $form_settings)) {
                    $form_submission->sent = 1;
                    $form_submission->save();
                }

                Session::put('form_data', $form_submission);
                return \redirect(PageBuilder::pageUrl($form_settings->page_to));
            } else {
                FormMessage::set($v->messages());
                if (!$captcha && $form_settings->captcha) {
                    FormMessage::add('captcha_code', 'Invalid Captcha Code, try again.');
                }
            }

        } else {
            return Response::make('No form settings found, try saving the form block in the admin.', 500);
        }

        return false;
    }
public function submission ( $ formData ) { if ( $ form_settings = $ this -> _block -> getContent ( true ) ) { $ form_settings = $ this -> _defaultData ( $ form_settings ) ; $ form_rules = BlockFormRule :: get_rules ( $ form_settings -> template ? : $ this -> _block -> name ) ; $ v = Validator :: make ( $ formData , $ form_rules ) ; $ captcha = Securimage :: captchaCheck ( ) ; // check form rules
 if ( $ v -> passes ( ) && ! ( $ form_settings -> captcha && ! $ captcha ) ) { // delete blank and system fields
 unset ( $ formData [ 'captcha_code' ] ) ; // Save data function (override this function to save data differently)
 $ form_submission = $ this -> submissionSaveData ( $ formData ) ; if ( ! $ form_submission -> id ) { FormMessage :: add ( 'submission_save_error' , 'Unable to save the form.' ) ; } // Send email
 if ( $ this -> submissionSendEmail ( unserialize ( $ form_submission -> content ) , $ form_settings ) ) { $ form_submission -> sent = 1 ; $ form_submission -> save ( ) ; } Session :: put ( 'form_data' , $ form_submission ) ; return \ redirect ( PageBuilder :: pageUrl ( $ form_settings -> page_to ) ) ; } else { FormMessage :: set ( $ v -> messages ( ) ) ; if ( ! $ captcha && $ form_settings -> captcha ) { FormMessage :: add ( 'captcha_code' , 'Invalid Captcha Code, try again.' ) ; } } } else { return Response :: make ( 'No form settings found, try saving the form block in the admin.' , 500 ) ; } return false ; }
Save form data and send email
@param array $formData
@return bool|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
Save form data and send email