/** * 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(); }
public function favorite($spriteid, Request $request) { if ($request->input("t") == csrf_token()) { $favorite = Mark::where("alphaid", "=", $spriteid)->where("username", "=", Auth::user()->alphaid); if ($favorite->exists()) { $favorite->first()->delete(); } // All data clear! Continue: Mark::create(["alphaid" => $spriteid, "username" => Auth::user()->alphaid]); } else { abort(403); } return redirect()->back(); }
public function store(RecordMark $request) { Mark::create($request->all()); }