Skip to content

Commit 45b19d9

Browse files
[12.x] Allow for BackedEnum on dynamic blade component (#56940)
* Allow for BackedEnum on dynamic blade component * use enum_value() helper function Co-authored-by: Andrew Brown <[email protected]> * Fix missing function import --------- Co-authored-by: Andrew Brown <[email protected]>
1 parent fcc38ab commit 45b19d9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Illuminate/View/DynamicComponent.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
namespace Illuminate\View;
44

5+
use BackedEnum;
56
use Illuminate\Container\Container;
67
use Illuminate\Support\Collection;
78
use Illuminate\Support\Str;
89
use Illuminate\View\Compilers\ComponentTagCompiler;
910

11+
use function Illuminate\Support\enum_value;
12+
1013
class DynamicComponent extends Component
1114
{
1215
/**
@@ -33,11 +36,11 @@ class DynamicComponent extends Component
3336
/**
3437
* Create a new component instance.
3538
*
36-
* @param string $component
39+
* @param \BackedEnum|string $component
3740
*/
38-
public function __construct(string $component)
41+
public function __construct(BackedEnum|string $component)
3942
{
40-
$this->component = $component;
43+
$this->component = (string) enum_value($component);
4144
}
4245

4346
/**

0 commit comments

Comments
 (0)