public function editLetterName() { // Declare the rules for the form validation $rules = array('rname' => 'required'); // Create a new validator instance from our validation rules $validator = Validator::make(Input::all(), $rules); // If validation fails, we'll exit the operation now. if ($validator->fails()) { $data['status'] = 'error'; $data['errors'] = $validator->messages()->toArray(); } else { $form_id = Input::get('form_id'); $form = Forms::where('id', $form_id)->first(); $form->name = Input::get('rname'); if ($form->save()) { $data['status'] = 'success'; } else { $data['status'] = 'error'; } } return Response::json($data); }
public function postPfTemplateSelectList($destination) { $query = Forms::where('pid', '=', Session::get('pid'))->where('forms_destination', '=', $destination)->get(); $data['options'] = array(); if ($query) { $data['options'][''] = "*Select completed forms below."; foreach ($query as $row) { $data['options'][$row->forms_id] = $row->forms_title . ", completed on " . date('m/d/Y', $this->human_to_unix($row->forms_date)); } } else { $data['options'][''] = "No forms completed by patient."; } echo json_encode($data); }
public function getEmbedForm($id = null) { if ($form = Forms::where('unique_id', $id)->where('status', 'active')->first()) { $form = Forms::where('unique_id', $id)->where('status', 'active')->first(); $fields = FormFields::where('form_id', $form->id)->get(); return View::make('frontend/forms/embed', compact('form', 'fields')); } }