src/SmartyServiceProvider.php
public function register()
    {
        $configPath = __DIR__ . '/config/ytake-laravel-smarty.php';
        $this->mergeConfigFrom($configPath, 'ytake-laravel-smarty');
        $this->publishes([
            $configPath => $this->resolveConfigurePath() . DIRECTORY_SEPARATOR . 'ytake-laravel-smarty.php',
        ]);

        $this->app->singleton('smarty.view', function ($app) {
            $smartyTemplate = new Smarty;
            $factory = new SmartyFactory(
                $app['view.engine.resolver'],
                $app['view.finder'],
                $app['events'],
                $smartyTemplate,
                $this->app['config']
            );
            // Pass the container to the factory so it can be used to resolve view composers.
            $factory->setContainer($app);
            $factory->share('app', $app);
            // resolve cache storage
            $factory->resolveSmartyCache();
            // smarty configure(use ytake-laravel-smarty.php)
            $factory->setSmartyConfigure();
            $smartyTemplate->setViewFactory($factory);

            return $factory;
        });
        $this->app->alias('smarty.view', SmartyFactory::class);
    }
public function register()
    {
        $configPath = __DIR__ . '/config/ytake-laravel-smarty.php';
        $this->mergeConfigFrom($configPath, 'ytake-laravel-smarty');
        $this->publishes([
            $configPath => $this->resolveConfigurePath() . DIRECTORY_SEPARATOR . 'ytake-laravel-smarty.php',
        ]);

        $this->app->singleton('smarty.view', function ($app) {
            $smartyTemplate = new Smarty;
            $factory = new SmartyFactory(
                $app['view.engine.resolver'],
                $app['view.finder'],
                $app['events'],
                $smartyTemplate,
                $this->app['config']
            );
            // Pass the container to the factory so it can be used to resolve view composers.
            $factory->setContainer($app);
            $factory->share('app', $app);
            // resolve cache storage
            $factory->resolveSmartyCache();
            // smarty configure(use ytake-laravel-smarty.php)
            $factory->setSmartyConfigure();
            $smartyTemplate->setViewFactory($factory);

            return $factory;
        });
        $this->app->alias('smarty.view', SmartyFactory::class);
    }
{@inheritdoc}