Пример #1
0
 /**
  * Show home page
  * GET /
  */
 public function getIndex()
 {
     $perPage = Config::get('site.snippetsPerPage');
     $snippets = $this->snippet->byPage($perPage);
     $topSnippetContributors = $this->user->getTopSnippetContributors();
     $mostViewedSnippets = $this->snippet->getMostViewed(10);
     $tags = $this->tag->all();
     return View::make('website.pages.index', compact('snippets', 'topSnippetContributors', 'mostViewedSnippets', 'tags'));
 }
 /**
  * Show listing of snippets
  * GET /snippets
  */
 public function getIndex()
 {
     $page = Input::get('page', 1);
     // Candidate for config item
     $perPage = 30;
     $pagiData = $this->snippet->byPage($page, $perPage);
     $snippets = Paginator::make($pagiData->items, $pagiData->totalItems, $perPage);
     $tags = $this->tag->all();
     $topSnippetContributors = $this->user->getTopSnippetContributors();
     return View::make('snippets.index', compact('snippets', 'tags', 'topSnippetContributors'));
 }
 /**
  * Show listing of snippets
  * GET /snippets
  */
 public function getIndex()
 {
     $perPage = Config::get('site.snippetsPerPage');
     if (Request::has('q') and Request::get('q') !== '') {
         $snippets = $this->snippet->byPage($perPage, false, e(Request::get('q')));
     } else {
         $snippets = $this->snippet->byPage($perPage);
     }
     $tags = $this->tag->all();
     $topSnippetContributors = $this->user->getTopSnippetContributors();
     return View::make('snippets.index', compact('snippets', 'tags', 'topSnippetContributors'));
 }