/** * Injects data from config into the current view * * @param Illuminate\View\View $view * @return void */ public function compose($view) { if (!self::$loadMultipleTimes && !self::$firstView) { return; } $viewData = $view->getData(); $viewName = $view->getName(); $vars = $this->getVars($viewName); if (count($vars)) { $this->DataBuilder->setData($viewData); $data = $this->DataBuilder->compile($vars); foreach ($data as $varName => $value) { $view->with($varName, $value); } } self::$firstView = false; }
/** * This method will output the rendered template content * * @param string $template The path to the Blade template, relative to the Blade templates directory. * * @return Illuminate\View\View */ protected function render($template, $data = array()) { $view = null; $data = array_merge_recursive($this->all(), $data); $data['app'] = $this->app; $template = $this->resolve($template); if (!$template) { return; } if (!$this->layout) { $view = $this->make($template, $data); } else { $view = $this->layout->nest('content', $template, $data); } return $view; }