/** * Get the string contents of the view. * * @param \Closure $callback * @return string */ public function render(Closure $callback = null) { $contents = $this->renderContents(); $response = isset($callback) ? $callback($this, $contents) : null; // Once we have the contents of the view, we will flush the sections if we are // done rendering all views so that there is nothing left hanging over when // another view is rendered in the future via the application developers. $this->environment->flushSectionsIfDoneRendering(); return $response ?: $contents; }
/** * Flush all of the section contents if done rendering. * * @return void * @static */ public static function flushSectionsIfDoneRendering() { \Illuminate\View\Environment::flushSectionsIfDoneRendering(); }