public function getForm($id = null) { if ($request = FormRequests::where('id', $id)->where('status', 'active')->first()) { $seeker = $request->seeker()->first(); $writer = $request->writer()->first(); $request->form_id; if ($form = Forms::where('id', $request->form_id)->where('status', 'active')->first()) { $tabs = $form->tabs()->get(); $fields = $form->fields()->get(); } return View::make('frontend/form', compact('request', 'seeker', 'writer', 'form', 'tabs', 'fields')); } return Response::make(View::make('error/404'), 404); }
public function getSkillScore() { $code = Input::get('code'); $field = FormFields::where('unique_id', $code)->first(); $form_id = $field->form_id; $request = FormRequests::where('form_id', $form_id)->first(); $request_id = $request->id; $writer = FormWriterDetails::where('form_request_id', $request_id)->first(); $writer_name = $writer->first_name . ' ' . $writer->last_name; $submission = FormSubmissions::where('field_id', $field->id)->first(); $option = $submission->option; $option = json_decode($option, true); $score = $option[0]; $year = $option[1]; $data['status'] = 'success'; $data['score'] = $score; $data['year'] = $year; $data['writer'] = $writer_name; return Response::json($data); }