public function DisplaySinglePost($slug)
    {
        // If this is a page, then display the page
        if ($this->isBladeFile($slug)) {
            return view('pages/' . $slug, [
                'DatesHelper'       => DatesHelper::class,
                'HTMLHelper'        => HTMLHelper::class,
                'ImagesHelper'      => $this->imagesHelper,
            ]);
        }


        // This slug refers to a single post
        $post = $this->repository->findEnabledPostBySlug($slug);

        if (count($post) == 0) {

            // post not found, so display the 404 page
            //return view('errors/404');
            return $this->home();
        }

        // Figure out if the post is using a specified featured image; or, if no such image,
        // then use the category's default image as this post's featured image.
        $post->featured_image = $this->imagesHelper->categoryImageDefaultOrSpecified($post->featured_image);

        // Resize the post's featured image -- if not yet resized.
        $this->imagesHelper->createPostResizedImageFiles($post->featured_image);


        // Set up the social media tags

        // first, set up the image
        if ($post->featured_image == "") {
            $post->featured_image = Config::get('lasallecmsfrontend.social_media_default_image');
        }
        $post->urlImage = $this->imagesHelper->urlOfImage($post->featured_image,600,600);


        // second, create the social media tag arrays
        $openGraph = HTMLHelper::createOpenGraphTagsForPost($post);
        $twitter   = HTMLHelper::createTwitterTagsForPost($post);
        $google    = HTMLHelper::createGoogleTagsForPost($post);



        // "Next" and "Previous" navigation within a single post... well, there can be multiple categories per post,
        //  so should the "Next" and "Previous" links refer to any ol' post regardless of category; or, should the
        //  "Next" and "Previous" links within a post refer strictly to posts assigned to the same category?
        //  Since my intention is to group posts by category, the answer is "assigned to the same category".
        //
        //  So... my intention is that POSTS assign to just one category, despite the ability to assign multiple categories.
        //  Hey, this multiple category thing is really intended for ecommerce, where the parent category = "Products".
        //  For regular ol' POSTS, my intention is a mandatory one category per post. Essentially creating a one-to-one
        //  relationship, which is my working assumption for "Next" and "Previous" single post navigation.

        // So, first of all, must be just one category for this post
        $category = $this->repository->findCategoryForPostById($post->id);

        if (count($category) == 1)
        {
            // Next post
            $nextPost     = $this->repository->getNextPost($category[0]->category_id, $post->publish_on);

            // Previous post
            $previousPost = $this->repository->getPreviousPost($category[0]->category_id, $post->publish_on);

            // The category's title
            $categoryTitle    = $this->repository->getCategoryTitleById($category[0]->category_id);
        }

        // tags
        $tagTitles = $this->repository->getTagTitlesByPostId($post->id);


        return view('posts/single_post', [
            'post'              => $post,
            'DatesHelper'       => DatesHelper::class,
            'HTMLHelper'        => HTMLHelper::class,
            'ImagesHelper'      => $this->imagesHelper,
            'openGraph'         => $openGraph,
            'twitter'           => $twitter,
            'google'            => $google,
            'nextPost'          => $nextPost,
            'previousPost'  => $previousPost,
            'categoryTitle'     => $categoryTitle,
            'tagTitles'         => $tagTitles,
        ]);
    }
public function DisplaySinglePost($slug)
    {
        // If this is a page, then display the page
        if ($this->isBladeFile($slug)) {
            return view('pages/' . $slug, [
                'DatesHelper'       => DatesHelper::class,
                'HTMLHelper'        => HTMLHelper::class,
                'ImagesHelper'      => $this->imagesHelper,
            ]);
        }


        // This slug refers to a single post
        $post = $this->repository->findEnabledPostBySlug($slug);

        if (count($post) == 0) {

            // post not found, so display the 404 page
            //return view('errors/404');
            return $this->home();
        }

        // Figure out if the post is using a specified featured image; or, if no such image,
        // then use the category's default image as this post's featured image.
        $post->featured_image = $this->imagesHelper->categoryImageDefaultOrSpecified($post->featured_image);

        // Resize the post's featured image -- if not yet resized.
        $this->imagesHelper->createPostResizedImageFiles($post->featured_image);


        // Set up the social media tags

        // first, set up the image
        if ($post->featured_image == "") {
            $post->featured_image = Config::get('lasallecmsfrontend.social_media_default_image');
        }
        $post->urlImage = $this->imagesHelper->urlOfImage($post->featured_image,600,600);


        // second, create the social media tag arrays
        $openGraph = HTMLHelper::createOpenGraphTagsForPost($post);
        $twitter   = HTMLHelper::createTwitterTagsForPost($post);
        $google    = HTMLHelper::createGoogleTagsForPost($post);



        // "Next" and "Previous" navigation within a single post... well, there can be multiple categories per post,
        //  so should the "Next" and "Previous" links refer to any ol' post regardless of category; or, should the
        //  "Next" and "Previous" links within a post refer strictly to posts assigned to the same category?
        //  Since my intention is to group posts by category, the answer is "assigned to the same category".
        //
        //  So... my intention is that POSTS assign to just one category, despite the ability to assign multiple categories.
        //  Hey, this multiple category thing is really intended for ecommerce, where the parent category = "Products".
        //  For regular ol' POSTS, my intention is a mandatory one category per post. Essentially creating a one-to-one
        //  relationship, which is my working assumption for "Next" and "Previous" single post navigation.

        // So, first of all, must be just one category for this post
        $category = $this->repository->findCategoryForPostById($post->id);

        if (count($category) == 1)
        {
            // Next post
            $nextPost     = $this->repository->getNextPost($category[0]->category_id, $post->publish_on);

            // Previous post
            $previousPost = $this->repository->getPreviousPost($category[0]->category_id, $post->publish_on);

            // The category's title
            $categoryTitle    = $this->repository->getCategoryTitleById($category[0]->category_id);
        }

        // tags
        $tagTitles = $this->repository->getTagTitlesByPostId($post->id);


        return view('posts/single_post', [
            'post'              => $post,
            'DatesHelper'       => DatesHelper::class,
            'HTMLHelper'        => HTMLHelper::class,
            'ImagesHelper'      => $this->imagesHelper,
            'openGraph'         => $openGraph,
            'twitter'           => $twitter,
            'google'            => $google,
            'nextPost'          => $nextPost,
            'previousPost'  => $previousPost,
            'categoryTitle'     => $categoryTitle,
            'tagTitles'         => $tagTitles,
        ]);
    }
public function DisplaySinglePost ( $ slug ) { // If this is a page, then display the page if ( $ this -> isBladeFile ( $ slug ) ) { return view ( 'pages/' . $ slug , [ 'DatesHelper' => DatesHelper :: class , 'HTMLHelper' => HTMLHelper :: class , 'ImagesHelper' => $ this -> imagesHelper , ] ) ; } // This slug refers to a single post $ post = $ this -> repository -> findEnabledPostBySlug ( $ slug ) ; if ( count ( $ post ) == 0 ) { // post not found, so display the 404 page //return view('errors/404'); return $ this -> home ( ) ; } // Figure out if the post is using a specified featured image; or, if no such image, // then use the category's default image as this post's featured image. $ post -> featured_image = $ this -> imagesHelper -> categoryImageDefaultOrSpecified ( $ post -> featured_image ) ; // Resize the post's featured image -- if not yet resized. $ this -> imagesHelper -> createPostResizedImageFiles ( $ post -> featured_image ) ; // Set up the social media tags // first, set up the image if ( $ post -> featured_image == "" ) { $ post -> featured_image = Config :: get ( 'lasallecmsfrontend.social_media_default_image' ) ; } $ post -> urlImage = $ this -> imagesHelper -> urlOfImage ( $ post -> featured_image , 600 , 600 ) ; // second, create the social media tag arrays $ openGraph = HTMLHelper :: createOpenGraphTagsForPost ( $ post ) ; $ twitter = HTMLHelper :: createTwitterTagsForPost ( $ post ) ; $ google = HTMLHelper :: createGoogleTagsForPost ( $ post ) ; // "Next" and "Previous" navigation within a single post... well, there can be multiple categories per post, //  so should the "Next" and "Previous" links refer to any ol' post regardless of category; or, should the //  "Next" and "Previous" links within a post refer strictly to posts assigned to the same category? //  Since my intention is to group posts by category, the answer is "assigned to the same category". // //  So... my intention is that POSTS assign to just one category, despite the ability to assign multiple categories. //  Hey, this multiple category thing is really intended for ecommerce, where the parent category = "Products". //  For regular ol' POSTS, my intention is a mandatory one category per post. Essentially creating a one-to-one //  relationship, which is my working assumption for "Next" and "Previous" single post navigation. // So, first of all, must be just one category for this post $ category = $ this -> repository -> findCategoryForPostById ( $ post -> id ) ; if ( count ( $ category ) == 1 ) { // Next post $ nextPost = $ this -> repository -> getNextPost ( $ category [ 0 ] -> category_id , $ post -> publish_on ) ; // Previous post $ previousPost = $ this -> repository -> getPreviousPost ( $ category [ 0 ] -> category_id , $ post -> publish_on ) ; // The category's title $ categoryTitle = $ this -> repository -> getCategoryTitleById ( $ category [ 0 ] -> category_id ) ; } // tags $ tagTitles = $ this -> repository -> getTagTitlesByPostId ( $ post -> id ) ; return view ( 'posts/single_post' , [ 'post' => $ post , 'DatesHelper' => DatesHelper :: class , 'HTMLHelper' => HTMLHelper :: class , 'ImagesHelper' => $ this -> imagesHelper , 'openGraph' => $ openGraph , 'twitter' => $ twitter , 'google' => $ google , 'nextPost' => $ nextPost , 'previousPost' => $ previousPost , 'categoryTitle' => $ categoryTitle , 'tagTitles' => $ tagTitles , ] ) ; }
Display the individual post

@param $slug  Post's slug
@return view
Display the individual post