diff --git a/src/Illuminate/View/Concerns/ManagesLayouts.php b/src/Illuminate/View/Concerns/ManagesLayouts.php index 12a103d4fa51..cd494f8e0aa5 100644 --- a/src/Illuminate/View/Concerns/ManagesLayouts.php +++ b/src/Illuminate/View/Concerns/ManagesLayouts.php @@ -25,7 +25,7 @@ trait ManagesLayouts * * @var string */ - protected static $parentPlaceholder; + protected static $parentPlaceholder = []; /** * Start injecting content into a section. @@ -164,11 +164,11 @@ public function yieldContent($section, $default = '') */ public static function parentPlaceholder($section = '') { - if (! static::$parentPlaceholder) { - static::$parentPlaceholder = '##parent-placeholder-'.sha1($section).'##'; + if (! isset(static::$parentPlaceholder[$section])) { + static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##'; } - return static::$parentPlaceholder; + return static::$parentPlaceholder[$section]; } /** diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php index 73d17ed95d46..695a711e53fb 100755 --- a/tests/View/ViewFactoryTest.php +++ b/tests/View/ViewFactoryTest.php @@ -213,7 +213,7 @@ public function testBasicSectionHandling() public function testSectionExtending() { - $placeholder = \Illuminate\View\Factory::parentPlaceholder(); + $placeholder = \Illuminate\View\Factory::parentPlaceholder('foo'); $factory = $this->getFactory(); $factory->startSection('foo'); echo 'hi '.$placeholder; @@ -226,7 +226,7 @@ public function testSectionExtending() public function testSectionMultipleExtending() { - $placeholder = \Illuminate\View\Factory::parentPlaceholder(); + $placeholder = \Illuminate\View\Factory::parentPlaceholder('foo'); $factory = $this->getFactory(); $factory->startSection('foo'); echo 'hello '.$placeholder.' nice to see you '.$placeholder;