From 4b1e317c7aec22c2767766bb8b84e059fe4e0802 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 9 Sep 2020 08:08:34 -0500 Subject: [PATCH] fix dynamic component bug --- src/Illuminate/View/DynamicComponent.php | 4 ++-- tests/Integration/View/BladeTest.php | 2 +- .../View/templates/uses-panel-dynamically.blade.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/View/DynamicComponent.php b/src/Illuminate/View/DynamicComponent.php index 9bc616ca2e3f..b45715212bbe 100644 --- a/src/Illuminate/View/DynamicComponent.php +++ b/src/Illuminate/View/DynamicComponent.php @@ -54,7 +54,7 @@ public function __construct(string $component) public function render() { $template = <<<'EOF' -getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel($key) => $value]; })->all(), EXTR_SKIP); ?> +getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace(':', ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?> {{ props }} {{ slots }} @@ -113,7 +113,7 @@ protected function compileProps(array $bindings) protected function compileBindings(array $bindings) { return collect($bindings)->map(function ($key) { - return ':'.$key.'="$'.Str::camel($key).'"'; + return ':'.$key.'="$'.Str::camel(str_replace(':', ' ', $key)).'"'; })->implode(' '); } diff --git a/tests/Integration/View/BladeTest.php b/tests/Integration/View/BladeTest.php index d9e26768a1b0..bba1416dc86c 100644 --- a/tests/Integration/View/BladeTest.php +++ b/tests/Integration/View/BladeTest.php @@ -30,7 +30,7 @@ public function test_rendering_a_dynamic_component() { $view = View::make('uses-panel-dynamically', ['name' => 'Taylor'])->render(); - $this->assertEquals('
+ $this->assertEquals('
Hello Taylor
', trim($view)); } diff --git a/tests/Integration/View/templates/uses-panel-dynamically.blade.php b/tests/Integration/View/templates/uses-panel-dynamically.blade.php index 6c123fbbab1e..ab739a4ea06f 100644 --- a/tests/Integration/View/templates/uses-panel-dynamically.blade.php +++ b/tests/Integration/View/templates/uses-panel-dynamically.blade.php @@ -1,3 +1,3 @@ - + Panel contents