/** * View detail of video * * @param type $slug * @param \App\Repositories\PostInterface $videoRepository * @return \Illuminate\View\View */ public function viewDetail($slug, VideoInterface $videoRepository) { $video = $videoRepository->findBy('slug', $slug)->first(); $relatedVideos = $videoRepository->getRelatedVideo($video->category_id); $data = ['video' => AutoPresenter::decorate($video), 'relatedVideos' => AutoPresenter::decorate($relatedVideos)]; return view('video.detail', $data); }
/** * Show the application dashboard to the user. * * @param VideoInterface $video * @return Response */ public function index(VideoInterface $videoRepository, PostInterface $postRepository) { // Get posts $posts = $postRepository->all()->take(6); // Get videos $videos = $videoRepository->all()->take(6); // Bind data to view $data = ['posts' => AutoPresenter::decorate($posts), 'videos' => AutoPresenter::decorate($videos)]; return view('home.home', $data); }