children()->listed()->flip(); // add the tag filter if($tag = param('tag')) { $articles = $articles->filterBy('tags', $tag, ','); } // fetch all tags $tags = $articles->pluck('tags', ',', true); // apply pagination $articles = $articles->paginate(7); $pagination = $articles->pagination(); return compact('articles', 'tags', 'tag', 'pagination'); }; function split_words($string, $url) { if (strlen($string) > 1000) { // truncate string $stringCut = substr($string, 0, 1000); // make sure it ends in a word so assassinate doesn't become ass... $string = substr($stringCut, 0, strrpos($stringCut, ' ')).'...
'; } return $string; } ?>