public function preview($entity, $id)
    {
        $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);

        if (!class_exists($modelString)) {
            $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity).'s';
        }

        $model = new $modelString();
        $modelInstance = $model->find($id);

        $data = [
            $entity => $modelInstance,
        ];

        if (config('app.locale') != config('cms.default-language', Cms::config('cms.default-language'))) {
            if ($modelInstance->translation(config('app.locale'))) {
                $data = [
                    $entity => $modelInstance->translation(config('app.locale'))->data,
                ];
            }
        }

        $view = 'cms-frontend::'.$entity.'.show';

        if (!View::exists($view)) {
            $view = 'cms-frontend::'.$entity.'s.show';
        }

        if ($entity === 'page') {
            $view = 'cms-frontend::pages.'.$modelInstance->template;
        }

        if ($entity === 'blog') {
            $view = 'cms-frontend::blog.'.$modelInstance->template;
        }

        return view($view, $data);
    }
public function preview($entity, $id)
    {
        $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);

        if (!class_exists($modelString)) {
            $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity).'s';
        }

        $model = new $modelString();
        $modelInstance = $model->find($id);

        $data = [
            $entity => $modelInstance,
        ];

        if (config('app.locale') != config('cms.default-language', Cms::config('cms.default-language'))) {
            if ($modelInstance->translation(config('app.locale'))) {
                $data = [
                    $entity => $modelInstance->translation(config('app.locale'))->data,
                ];
            }
        }

        $view = 'cms-frontend::'.$entity.'.show';

        if (!View::exists($view)) {
            $view = 'cms-frontend::'.$entity.'s.show';
        }

        if ($entity === 'page') {
            $view = 'cms-frontend::pages.'.$modelInstance->template;
        }

        if ($entity === 'blog') {
            $view = 'cms-frontend::blog.'.$modelInstance->template;
        }

        return view($view, $data);
    }
public function preview ( $ entity , $ id ) { $ modelString = 'Grafite\Cms\Models\\' . ucfirst ( $ entity ) ; if ( ! class_exists ( $ modelString ) ) { $ modelString = 'Grafite\Cms\Models\\' . ucfirst ( $ entity ) . 's' ; } $ model = new $ modelString ( ) ; $ modelInstance = $ model -> find ( $ id ) ; $ data = [ $ entity => $ modelInstance , ] ; if ( config ( 'app.locale' ) != config ( 'cms.default-language' , Cms :: config ( 'cms.default-language' ) ) ) { if ( $ modelInstance -> translation ( config ( 'app.locale' ) ) ) { $ data = [ $ entity => $ modelInstance -> translation ( config ( 'app.locale' ) ) -> data , ] ; } } $ view = 'cms-frontend::' . $ entity . '.show' ; if ( ! View :: exists ( $ view ) ) { $ view = 'cms-frontend::' . $ entity . 's.show' ; } if ( $ entity === 'page' ) { $ view = 'cms-frontend::pages.' . $ modelInstance -> template ; } if ( $ entity === 'blog' ) { $ view = 'cms-frontend::blog.' . $ modelInstance -> template ; } return view ( $ view , $ data ) ; }
Preview content.

@param string $entity
@param int    $id

@return Response
Preview content .