Skip to content

Commit aab9937

Browse files
authored
Merge pull request #1196 from livewire/josh/fix-v1-laravel-12
[1.x] Fix anonymous component views for Laravel 12
2 parents 94b47e1 + 5bf38c0 commit aab9937

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/FluxManager.php

+5
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public function applyInset($inset, $top, $right, $bottom, $left)
140140

141141
public function componentExists($name)
142142
{
143+
// Laravel 12+ uses xxh128 hashing for views https://github.com/laravel/framework/pull/52301...
144+
if (app()->version() >= 12) {
145+
return app('view')->exists(hash('xxh128', 'flux') . '::' . $name);
146+
}
147+
143148
return app('view')->exists(md5('flux') . '::' . $name);
144149
}
145150
}

src/FluxTagCompiler.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ public function componentString(string $component, array $attributes)
1414

1515
$class = \Illuminate\View\AnonymousComponent::class;
1616

17+
// Laravel 12+ uses xxh128 hashing for views https://github.com/laravel/framework/pull/52301...
1718
return "##BEGIN-COMPONENT-CLASS##@component('{$class}', 'flux::' . {$component}, [
18-
'view' => md5('flux') . '::' . {$component},
19+
'view' => (app()->version() >= 12 ? hash('xxh128', 'flux') : md5('flux')) . '::' . {$component},
1920
'data' => \$__env->getCurrentComponentData(),
2021
])
2122
<?php \$component->withAttributes(\$attributes->getAttributes()); ?>";

0 commit comments

Comments
 (0)