private function sendEmail($input) { $form = BuiltForm::findOrFail($input['form_id']); if ($form->email == '') { return; } $input = $this->formatInputForEmail($input, $form->data); $exported_var = var_export($input, true); $exported_var = str_replace("array (", "", $exported_var); $exported_var = str_replace("',", "'<br>", $exported_var); $exported_var = str_replace(")", "", $exported_var); $input['exported_var'] = $exported_var; Mail::send('public.' . $this->current_theme . '.email_form', $input, function ($email_message) use($input, $form) { $email_message->from($form->email); $email_message->to($form->email)->subject('Email from Form'); }); }
public static function create(array $attributes = array()) { // dd($attributes); static::isValid($attributes); if (isset($attributes['captcha'])) { // Do not save the value of captcha to database unset($attributes['captcha']); } unset($attributes['_token']); $entry['form_id'] = $attributes['form_id']; unset($attributes['form_id']); $form = BuiltForm::findOrFail($entry['form_id']); $module_builder = new Services\ModuleBuilder(); $form_fields = $module_builder->getFormFields($form->data); $fields = array_combine($form_fields['fields'], $form_fields['field_names']); $entry['data'] = json_encode($attributes); $entry['fields'] = json_encode($fields); // dd($entry); return parent::create($entry); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $form = \BuiltForm::findOrFail($id); if (\BuiltModule::where('form_id', '=', $id)->first()) { return \Redirect::back()->with('error_message', 'The form can\'t be deleted because a built module is using this form. <br> Either change the form in that built module or delete the module first to delete this form.'); } if ($form->delete()) { return \Redirect::to('backend/form-builder')->with('success_message', 'Form was deleted.'); } else { return \Redirect::to('backend/form-builder')->with('error_message', 'Form wasn\'t deleted.'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $form = \BuiltForm::findOrFail($id); if (\BuiltModule::where('form_id', '=', $id)->first()) { return \Redirect::back()->with('error_message', trans('error_messages.form_delete_assoc')); } if ($form->delete()) { return \Redirect::to('backend/form-builder')->with('success_message', trans('success_messages.form_delete')); } else { return \Redirect::to('backend/form-builder')->with('error_message', trans('error_messages.form_delete')); } }