public static function getPostTemplate($id = null, $trim = false)
    {
        if ($archive = self::isArchive()) {
            return $archive;
        }

        global $post;

        // If $post is empty try to fetc post from querystring
        if (!$post && isset($_GET['id']) && is_numeric($_GET['id'])) {
            $post = get_post($_GET['id']);

            if (!$post) {
                throw new \Error('The requested post was not found.');
            }
        }

        if (!$post) {
            return isset($_GET['id']) && !empty($_GET['id']) ? $_GET['id'] : $archive;
        }

        // If post is set, fetch the template
        $template = get_page_template_slug($post->ID);

        // If this is the front page and the template is set to page.php or page.blade.php default to just "page"
        if ($post->ID === (int)get_option('page_on_front') && in_array($template, array('page.php', 'page.blade.php'))) {
            return 'page';
        }

        if (!$template) {
            $template = self::detectCoreTemplate($post);
        }

        $template = $trim ? str_replace('.blade.php', '', $template) : $template;

        return $template;
    }