/** * Display the specified resource. * * @param $courseSlug * @param Request $request * @return Response */ public function show($courseSlug, Request $request) { $user = $request->user(); $course = $this->course->getCourse($courseSlug); if ($user) { $bestRounds = $this->course->getUserBestRounds($course->id, $user->id); $stats = $this->course->getUserStats($course->id, $user->id); } return view('courses.show', compact('course', 'stats', 'bestRounds', 'user')); }
/** * Display the specified resource. * * @param $courseSlug * @param $holeNumber * @param Request $request * @return Response */ public function show($courseSlug, $holeNumber, Request $request) { $course = $this->course->getCourse($courseSlug); $hole = $course->holes->filter(function ($hole) use($holeNumber) { return $hole->number == $holeNumber; })->first(); $user = $request->user(); if ($user) { $stats = $this->hole->getUserStats($hole->id, $user->id); } return view('courses.holes.show', compact('course', 'hole', 'stats')); }
/** * Show edit page for a round. * * @param $roundId * @return \Illuminate\View\View */ public function edit($roundId) { $courses = $this->course->listAllCourses(); $teeTypes = $this->teeType->listAllTeeTypes(); $round = $this->round->getRound($roundId); return view('rounds.edit', compact('round', 'courses', 'teeTypes')); }