FormController::store PHP Method

store() public method

public store ( )
    public function store()
    {
        $input = Input::all();
        try {
            FormEntry::create($input);
            $this->sendEmail($input);
        } catch (ValidationException $e) {
            return Redirect::back()->withInput()->withErrors($e->getErrors());
        } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return Redirect::back()->withInput()->with('error_message', trans('error_messages.form_found'));
        } catch (Exception $e) {
            return Redirect::back()->withInput()->with('error_message', $e->getMessage());
        }
        return Redirect::back()->with('success_message', trans('success_messages.form_submit'));
    }