예제 #1
0
 public function getPreview($id)
 {
     $data = ['kuesioner' => Kuesioner::find($id)];
     return $this->render('backend.pages.olahdata.kuesioner.preview', $data);
 }
예제 #2
0
 public function postSimpan(KuesionerGuruRequest $request)
 {
     $k = Kuesioner::find(request()->input('id'));
     $u = auth()->user();
     $par = Participation::where('user_id', $u->id)->whereHas('kelas', function ($query) use($k) {
         $query->where('gelombang_id', $k->gelombang_id);
     })->first();
     $kp = new KuesionerParticipation();
     $kp->participation_id = $par->id;
     $kp->kuesioner_id = $k->id;
     $k->partisipan()->save($kp);
     foreach (request()->input('pilihan') as $key => $value) {
         $val = new KuesionerValue();
         $val->value = $value;
         $val->kuesioner_item_id = $key;
         $kp->values()->save($val);
     }
     dd(request()->all());
 }