コード例 #1
0
 /**
  * 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));
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 protected function getStudent($studentsdcid)
 {
     return Student::where(['dcid' => $studentsdcid])->get();
 }
コード例 #4
0
 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;
 }