/** * Add a view instance to the view data. * * <code> * // Add a View instance to a View's data * $view = View::make('foo')->nest('footer', 'Partials/Footer'); * * // Equivalent functionality using the "with" method * $view = View::make('foo')->with('footer', View::make('Partials/Footer')); * </code> * * @param string $key * @param string $view * @param array $data * @param string|null $module * @return View */ public function nest($key, $view, array $data = array(), $module = null) { // The nested View instance inherit parent Data if none is given. if (empty($data)) { $data = $this->data; } return $this->with($key, $this->factory->make($view, $data, $module)); }
/** * Render the given view. * * @param string $view * @param array $data * @return \View\View */ protected function getView($view, $data) { return $this->views->make($view, $data)->render(); }