예제 #1
0
파일: Finder.php 프로젝트: creolab/krustr
 /**
  * Collection of entries in taxonomy by term
  * @param  string $term
  * @return View
  */
 public function entryTaxonomyCollection($term)
 {
     Profiler::start('FINDER - ENTRY TAXONOMY COLLECTION');
     // First get taxonomy
     $taxonomy = app('krustr.taxonomies')->findBySlug(Request::segment(2));
     if ($taxonomy) {
         $term = $this->termRepository->findBySlug($term);
         if ($term) {
             $entries = $this->entryRepository->allPublishedByTerm($term->id, $this->channel->resource);
         } else {
             return App::abort(404);
         }
         View::share('term', $term);
     } else {
         return App::abort(404);
     }
     // Share content
     View::share('entries', $entries);
     View::share('pagination', $this->entryRepository->pagination());
     View::share('taxonomy', $taxonomy);
     // Views that we need to search for
     $views = array($this->channel->name . '_' . $taxonomy->name_singular, $this->channel->name . '_taxonomy', $taxonomy->name_singular, 'taxonomy_' . $taxonomy->name_singular, $this->channel->resource_singular . '_collection', $this->channel->resource, $this->channel->resource . '_collection', 'taxonomy', 'collection', 'index');
     Profiler::end('FINDER - ENTRY TAXONOMY COLLECTION');
     // The view
     return $this->render($views);
 }