Skip to content

Commit 9949e48

Browse files
committed
support both 3.x and 4.x
1 parent 24304f6 commit 9949e48

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Component.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ public function voltComponentName(): string
8181
*/
8282
public function getAlias(): string
8383
{
84+
// Livewire 3.x alias registry...
85+
if (app()->has(ComponentRegistry::class)) {
86+
return $this->__alias ??= array_search(static::class, (fn () => $this->aliases)->call(
87+
app(ComponentRegistry::class),
88+
));
89+
}
90+
91+
// Livewire 4.x alias registry...
8492
return $this->__alias ??= array_search(static::class, (fn () => $this->resolvedComponentCache)->call(
8593
app('livewire.factory'),
8694
));

0 commit comments

Comments
 (0)