/** * View a video. * * @param $slug * @return mixed */ public function video($slug) { $slug = explode('-', $slug); $id = $slug[0]; $video = $this->video->with(['watchedVideo'])->where('id', $id); if ($video->count() > 0) { $next = $this->video->where('id', '>', $id); return view('Main.Videos.View')->withVideo($video->first())->withNext($next); } abort(404); }
public function relatedVideos($id) { $video = Video::with('tags.videos')->findOrFail($id); return $video->relatedVideos->take(5); }