protected function tagIndexData($tag)
    {
        $tag = Tag::where('tag', $tag)->firstOrFail();

        $reverse_direction = (bool) $tag->reverse_direction;

        $posts = Post::where('published_at', '<=', Carbon::now())
            ->whereHas('tags', function ($q) use ($tag) {
                $q->where('id', '=', $tag->id);
            })
            ->where('is_published', 1)
            ->orderBy('published_at', $reverse_direction ? 'asc' : 'desc')
            ->simplePaginate(config('blog.posts_per_page'));

        $posts->appends('tag', $tag->tag);

        $page_image = $tag->page_image ?: config('blog.page_image');

        return [
            'title' => $tag->title,
            'subtitle' => $tag->subtitle,
            'posts' => $posts,
            'page_image' => $page_image,
            'tag' => $tag,
            'reverse_direction' => $reverse_direction,
            'meta_description' => $tag->meta_description ?: \
            Settings::where('setting_name', 'blog_description')->find(1),
        ];
    }
protected function tagIndexData($tag)
    {
        $tag = Tag::where('tag', $tag)->firstOrFail();

        $reverse_direction = (bool) $tag->reverse_direction;

        $posts = Post::where('published_at', '<=', Carbon::now())
            ->whereHas('tags', function ($q) use ($tag) {
                $q->where('id', '=', $tag->id);
            })
            ->where('is_published', 1)
            ->orderBy('published_at', $reverse_direction ? 'asc' : 'desc')
            ->simplePaginate(config('blog.posts_per_page'));

        $posts->appends('tag', $tag->tag);

        $page_image = $tag->page_image ?: config('blog.page_image');

        return [
            'title' => $tag->title,
            'subtitle' => $tag->subtitle,
            'posts' => $posts,
            'page_image' => $page_image,
            'tag' => $tag,
            'reverse_direction' => $reverse_direction,
            'meta_description' => $tag->meta_description ?: \
            Settings::where('setting_name', 'blog_description')->find(1),
        ];
    }
protected function tagIndexData ( $ tag ) { $ tag = Tag :: where ( 'tag' , $ tag ) -> firstOrFail ( ) ; $ reverse_direction = ( bool ) $ tag -> reverse_direction ; $ posts = Post :: where ( 'published_at' , '<=' , Carbon :: now ( ) ) -> whereHas ( 'tags' , function ( $ q ) use ( $ tag ) { $ q -> where ( 'id' , '=' , $ tag -> id ) ; } ) -> where ( 'is_published' , 1 ) -> orderBy ( 'published_at' , $ reverse_direction ? 'asc' : 'desc' ) -> simplePaginate ( config ( 'blog.posts_per_page' ) ) ; $ posts -> appends ( 'tag' , $ tag -> tag ) ; $ page_image = $ tag -> page_image ? : config ( 'blog.page_image' ) ; return [ 'title' => $ tag -> title , 'subtitle' => $ tag -> subtitle , 'posts' => $ posts , 'page_image' => $ page_image , 'tag' => $ tag , 'reverse_direction' => $ reverse_direction , 'meta_description' => $ tag -> meta_description ? : \ Settings :: where ( 'setting_name' , 'blog_description' ) -> find ( 1 ) , ] ; }
Return data for a tag index page.

@param string $tag
@return array
Return data for a tag index page .