/** * set our class Lava83\LavaProto\View\FileViewFinder as default FileViewFinder * and set Lava83\LavaProto\View\View as default View * * @see Lava83\LavaProto\View\View * @see Lava83\LavaProto\View\FileViewFinder */ protected function registerViewFactory() { /** * @var \Illuminate\Contracts\Foundation\Application */ $app = $this->app; /** * FileViewFinder */ $app->extend('view.finder', function () use($app) { $paths = $app['config']['view.paths']; return new FileViewFinder($app['files'], $paths); }); /** * View Factory */ $app->extend('view', function () use($app) { $resolver = $app['view.engine.resolver']; $finder = $app['view.finder']; $env = new View($resolver, $finder, $app['events']); $env->setContainer($app); $env->share('app', $app); return $env; }); }
/** * * build a view response * * @param $sViewName * @param array $aData * @return \Illuminate\Http\Response */ public function view($sViewName, array $aData = []) { $view = $this->view->make($sViewName, $aData); $response = \Response::make($view); if ($cookies = $this->getCookies()) { foreach ($cookies as $cookie) { $response->withCookie($cookie); } } return $response; }