public function blogCategory(Request $request, Response $response)
    {
        $routeArgs =  $request->getAttribute('route')->getArguments();

        $checkCat = BlogCategories::where('slug', $routeArgs['slug'])->first();

        if (!$checkCat) {
            $this->flash('warning', 'Tag not found.');
            return $this->redirect($response, 'blog');
        }

        // Get/Set Page Number
        $page = 1;
        if (isset($routeArgs['page']) && is_numeric($routeArgs['page'])) {
            $page = $routeArgs['page'];
        }

        $posts = BlogCategories::withCount(['posts' => function ($query) {
            $query->where('status', 1)
                    ->where('publish_at', '<', Carbon::now());
        }])
            ->with(['posts' => function ($query) use ($page) {
                $query->where('status', 1)
                    ->where('publish_at', '<', Carbon::now())
                    ->with('category', 'tags', 'author')
                    ->withCount('comments', 'pendingComments')
                    ->skip($this->config['blog-per-page']*($page-1))
                    ->take($this->config['blog-per-page'])
                    ->orderBy('publish_at', 'DESC');
            }])
            ->find($checkCat->id);

       
        $pagination = new Paginator(
            $posts->posts_count,
            $this->config['blog-per-page'],
            $page,
            "/blog/category/".$checkCat->slug."/(:num)"
        );
        $pagination = $pagination;

        return $this->view->render(
            $response,
            'blog.twig',
            array(
                "category" => $checkCat,
                "posts" => $posts->posts,
                "pagination" => $pagination,
                "categoryPage" => true
            )
        );
    }