/** * action for /print-pdf for filling and printing pdfs */ public function printPdf(Request $request) { $student = is_string($request->get('student')) ? Student::where('id', $request->get('student'))->first() : $request->get('student'); $responses = is_string($request->get('responses')) ? json_decode($request->get('responses')) : $request->get('responses'); $fileOption = $request->get('fileOption'); $watermarkOption = $request->get('watermarkOption'); return $this->dispatch(new PrintPdf($student, $responses, $fileOption, $watermarkOption)); }
public function update(Request $request) { $iep = Iep::where('id', $request->json('iep'))->with('iepResponse')->first(); $student = Student::where('id', $request->json('studentid'))->first(); $user = User::where('dcid', $request->json('userdcid'))->first(); $form = Form::where('id', $request->json('formid'))->with(['responses' => function ($query) use($student, $request) { if (!empty($request->json('responseid'))) { $query->where('id', $request->json('responseid'))->first(); } else { $query->where('student_id', $student->id)->orderBy('whencreated', 'desc')->first(); } }])->first(); if ($iep->attach($form, $user)) { return (int) $form->responses[0]->id; } return 0; }
protected function getStudent($studentsdcid) { return Student::where(['dcid' => $studentsdcid])->get(); }
public function activate(Request $request) { $iep = Iep::find($request->json('iep')); $student = Student::where('dcid', $request->json('student')['dcid'])->firstOrFail(); if ($iep->activate($student)) { return 1; } return 0; }