/** * generate archive links by month and year * * @return array */ public function archive() { $posts = Page::published()->where('type', 1)->where('published_at', '<', Carbon::now()->startOfMonth())->get()->groupBy(function ($item) { return $item->published_at->formatLocalized('%B %Y'); }); $retVal = []; $key = 0; foreach ($posts as $archmonth => $item) { $retVal[$key]['link'] = url(\Config::get('tok3-publisher.default_route', 'publisher') . '/archive/' . $item[0]->published_at->formatLocalized('%Y-%m')); $retVal[$key]['txt'] = $archmonth . ' (' . count($item) . ')'; ++$key; } return $retVal; }
/** * sitemap mh :-) */ public function sitemap() { $pages = Page::published()->get(); echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; return view('tok3-publisher::sitemap', compact('pages')); }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index() { //$pages = Page::published()->paginate(25); // no pagiger due to use of datatables $pages = Page::published()->get(); return view($this->view->index_pages, compact('pages')); }