diff --git a/src/Illuminate/View/AppendableAttributeValue.php b/src/Illuminate/View/AppendableAttributeValue.php index 490ca408cdc0..f275801e4e1d 100644 --- a/src/Illuminate/View/AppendableAttributeValue.php +++ b/src/Illuminate/View/AppendableAttributeValue.php @@ -21,4 +21,14 @@ public function __construct($value) { $this->value = $value; } + + /** + * Get the string value. + * + * @return string + */ + public function __toString() + { + return (string) $this->value; + } } diff --git a/tests/Integration/View/BladeTest.php b/tests/Integration/View/BladeTest.php index e045be2a6dcf..48564b271d23 100644 --- a/tests/Integration/View/BladeTest.php +++ b/tests/Integration/View/BladeTest.php @@ -50,11 +50,17 @@ public function test_rendering_the_same_dynamic_component_with_different_attribu public function test_appendable_attributes() { - $view = View::make('uses-appendable-panel', ['name' => 'Taylor'])->render(); + $view = View::make('uses-appendable-panel', ['name' => 'Taylor', 'withOutside' => true])->render(); $this->assertSame('
Hello Taylor
', trim($view)); + + $view = View::make('uses-appendable-panel', ['name' => 'Taylor', 'withOutside' => false])->render(); + + $this->assertSame('
+ Hello Taylor +
', trim($view)); } protected function getEnvironmentSetUp($app) diff --git a/tests/Integration/View/templates/uses-appendable-panel.blade.php b/tests/Integration/View/templates/uses-appendable-panel.blade.php index 91de44552deb..df3f2698c568 100644 --- a/tests/Integration/View/templates/uses-appendable-panel.blade.php +++ b/tests/Integration/View/templates/uses-appendable-panel.blade.php @@ -1,3 +1,9 @@ - - Panel contents - +@if ($withOutside) + + Panel contents + +@else + + Panel contents + +@endif