/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { try { $timetable = Timetable::findOrFail($id); } catch (ModelNotFoundException $e) { return redirect('/dashboard')->withErrors('Timetable not found.'); } if ($timetable->user_id !== Auth::user()->id) { return redirect('/dashboard')->withErrors('Timetable not found.'); } $hot = new Hot(); $hot->parseJson($timetable->data); $rows = $hot->outputHotFormatToWebFormat(); return view('timetable.show')->with(compact('timetable', 'rows')); }