Exemplo n.º 1
0
 /**
  * View detail of post
  * 
  * @param type $slug
  * @param \App\Repositories\PostInterface $postRepository
  * @return \Illuminate\View\View
  */
 public function viewDetail($slug, PostInterface $postRepository)
 {
     $post = $postRepository->findBy('slug', $slug)->first();
     $relatedPosts = $postRepository->getRelatedPost($post->category_id);
     $data = ['post' => AutoPresenter::decorate($post), 'relatedPosts' => AutoPresenter::decorate($relatedPosts)];
     return view('post.detail', $data);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }