/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $template = AuditTemplate::findOrFail($id);
     $tempforms = AuditTemplateForm::where('audit_template_id', $template->id)->get();
     $forms = Form::where('audit_template_id', $template->id)->get();
     foreach ($forms as $form) {
         FormFormula::where('form_id', $form->id)->delete();
         FormCondition::where('form_id', $form->id)->delete();
         FormMultiSelect::where('form_id', $form->id)->delete();
         FormSingleSelect::where('form_id', $form->id)->delete();
     }
     AuditTemplateForm::where('audit_template_id', $template->id)->delete();
     Form::where('audit_template_id', $template->id)->delete();
     $template->delete();
     Session::flash('flash_message', 'Template successfully deleted!');
     return redirect()->route("audittemplate.index");
 }