Skip to content

Commit 4b1e317

Browse files
committed
fix dynamic component bug
1 parent 75e792d commit 4b1e317

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Illuminate/View/DynamicComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(string $component)
5454
public function render()
5555
{
5656
$template = <<<'EOF'
57-
<?php extract(collect($attributes->getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel($key) => $value]; })->all(), EXTR_SKIP); ?>
57+
<?php extract(collect($attributes->getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace(':', ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?>
5858
{{ props }}
5959
<x-{{ component }} {{ bindings }} {{ attributes }}>
6060
{{ slots }}
@@ -113,7 +113,7 @@ protected function compileProps(array $bindings)
113113
protected function compileBindings(array $bindings)
114114
{
115115
return collect($bindings)->map(function ($key) {
116-
return ':'.$key.'="$'.Str::camel($key).'"';
116+
return ':'.$key.'="$'.Str::camel(str_replace(':', ' ', $key)).'"';
117117
})->implode(' ');
118118
}
119119

tests/Integration/View/BladeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function test_rendering_a_dynamic_component()
3030
{
3131
$view = View::make('uses-panel-dynamically', ['name' => 'Taylor'])->render();
3232

33-
$this->assertEquals('<div class="ml-2">
33+
$this->assertEquals('<div class="ml-2" wire:model="foo">
3434
Hello Taylor
3535
</div>', trim($view));
3636
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<x-dynamic-component component="panel" class="ml-2" :name="$name">
1+
<x-dynamic-component component="panel" class="ml-2" :name="$name" wire:model="foo">
22
Panel contents
33
</x-dynamic-component>

0 commit comments

Comments
 (0)