public function allTags()
{
$tags = [];
$blogs = Blog::orderBy('created_at', 'desc')->get();
foreach ($blogs as $blog) {
foreach (explode(',', $blog->tags) as $tag) {
array_push($tags, $tag);
}
}
return array_unique($tags);
}
/** * Display all Blog entries. * * @param int $id * * @return Response */ public function tag($tag) { $blogs = $this->blogRepository->tags($tag); $tags = $this->blogRepository->allTags(); if (empty($blogs)) { abort(404); } return view('quarx-frontend::blog.all')->with('tags', $tags)->with('blogs', $blogs); }