/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function examAverageChart() { $exam_id = Input::get('exam_id'); $examAvg = Exam::find($exam_id)->marks->avg('obt_marks'); $jsonExamAvg = json_encode($examAvg); return $jsonExamAvg; }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $exams = Exam::find($request->exam); $exams->grades()->sync($request->input('grade_id')); return redirect('principal/create#exam-tab')->withInput(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Exam::find($id)->delete(); return redirect('author/materialimage'); }