From 51b20e82d41b337d0d38c59f9a9dc2040e46156e Mon Sep 17 00:00:00 2001 From: eschalks Date: Wed, 18 Mar 2015 08:28:58 +0100 Subject: [PATCH] Pass service container to SmartyFactory. Fixes an error that occurs when using view composers in combination with smarty templates. --- src/Smarty/SmartyServiceProvider.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Smarty/SmartyServiceProvider.php b/src/Smarty/SmartyServiceProvider.php index a2183ac..00288a2 100644 --- a/src/Smarty/SmartyServiceProvider.php +++ b/src/Smarty/SmartyServiceProvider.php @@ -38,13 +38,18 @@ public function register() $this->app['view'] = $this->app->share( function ($app) { - return new SmartyFactory( + $factory = new SmartyFactory( $app['view.engine.resolver'], $app['view.finder'], $app['events'], new Smarty, $this->app['config'] ); + + // Pass the container to the factory so it can be used to resolve view composers. + $factory->setContainer($app); + + return $factory; } );