public static function findBySlug($slug, $postTypeSlug = '')
    {
        $postTypeSlug = ($postTypeSlug ? $postTypeSlug : PostType::getSlug());

        $postObj = (new Post())->setTable($postTypeSlug);
        $post = $postObj
            ->where('slug_'.App::getLocale(), $slug)
            ->with($postObj->getDefaultRelations(getPostType($postTypeSlug)))
            ->first();

        return $post;
    }
public static function findBySlug($slug, $postTypeSlug = '')
    {
        $postTypeSlug = ($postTypeSlug ? $postTypeSlug : PostType::getSlug());

        $postObj = (new Post())->setTable($postTypeSlug);
        $post = $postObj
            ->where('slug_'.App::getLocale(), $slug)
            ->with($postObj->getDefaultRelations(getPostType($postTypeSlug)))
            ->first();

        return $post;
    }
public static function findBySlug ( $ slug , $ postTypeSlug = '' ) { $ postTypeSlug = ( $ postTypeSlug ? $ postTypeSlug : PostType :: getSlug ( ) ) ; $ postObj = ( new Post ( ) ) -> setTable ( $ postTypeSlug ) ; $ post = $ postObj -> where ( 'slug_' . App :: getLocale ( ) , $ slug ) -> with ( $ postObj -> getDefaultRelations ( getPostType ( $ postTypeSlug ) ) ) -> first ( ) ; return $ post ; }
Find a post by slug.

@param string $slug         the slug of the post
@param string $postTypeSlug the name of the post type, ex. post_services

@return object|null Returns post as array or null if not found
Find a post by slug .