/** * 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')); } }