Backend\FormBuilderController::store PHP Method

store() public method

Store a newly created resource in storage.
public store ( ) : Response
return Response
    public function store()
    {
        try {
            $input = \Input::all();
            $input['show_captcha'] = isset($input['show_captcha']);
            $validator = \BuiltForm::validate($input);
            if ($validator->passes()) {
                $form = \BuiltForm::create(array('name' => $input['name'], 'hash' => uniqid('form_'), 'category' => $input['category'], 'description' => $input['description'], 'show_captcha' => $input['show_captcha'], 'data' => $input['data'], 'redirect_to' => $input['redirect_to'], 'extra_code' => base64_decode($input['extra_code']), 'email' => $input['email'], 'rendered' => base64_decode($input['rendered'])));
                if ($form) {
                    return \Redirect::to('backend/form-builder')->with('success_message', trans('success_messages.form_create'));
                } else {
                    return \Redirect::to('backend/form-builder')->with('error_message', trans('error_messages.form_create'));
                }
            } else {
                // Form validation failed
                return \Redirect::back()->withInput()->withErrors($validator);
            }
        } catch (\Exception $e) {
            return \Redirect::back()->with('error_message', trans('error_messages.form_create'));
        }
    }