/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $marks = Mark::create(['exam_id' => $request->exam_id, 'student_id' => $request->student_id, 'obt_marks' => $request->obt_marks]); $exams = Exam::find($request->exam_id); $students = Student::find($request->student_id); $marks->exams()->save($exams); $marks->students()->save($students); return redirect('principal/create#mark-tab')->withInput(); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $student = Student::find($id); return $this->response->item($student, new StudentTransformer()); }