Beispiel #1
0
 /**
  * Get the string contents of the view.
  *
  * @param  \Closure  $callback
  * @return string
  */
 public function render(Closure $callback = null)
 {
     try {
         $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 gets rendered in the future by the application developer.
         $this->factory->flushSectionsIfDoneRendering();
         return $response ?: $contents;
     } catch (Exception $e) {
         $this->factory->flushSections();
         throw $e;
     }
 }
Beispiel #2
0
 /**
  * Flush all of the section contents.
  *
  * @return void 
  * @static 
  */
 public static function flushSections()
 {
     \Illuminate\View\Factory::flushSections();
 }