/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return Exam::where(['id' => $this->id, 'user_id' => $this->user()->id])->exists(); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $exam = Exam::findOrFail($id); return view('exams.show', compact('exam')); }
public function store($id, PaperRequest $request) { $exam = Exam::findOrFail($id); $paper = $request->file('paper'); (new AddPaperToExam($exam, $paper))->save(); }