From b317fdeea17465a84d15ad8dcac79ac32169cd9a Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Mon, 25 Nov 2024 17:10:10 +0100 Subject: [PATCH] format compat with Livewire --- resources/views/components/banner.blade.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/resources/views/components/banner.blade.php b/resources/views/components/banner.blade.php index 5150ff0..a28a462 100644 --- a/resources/views/components/banner.blade.php +++ b/resources/views/components/banner.blade.php @@ -105,15 +105,10 @@ this.runCallbacks(); this.show = false; }, - callbacks: { - @foreach($cookies as $group) - '{{ $group->key }}': function() { - {!! value($group->onAccepted) !!} - }, - @endforeach + {{-- Do not use @foreach of @if or it will break when used with Livewire --}} + {!! $cookies->map(fn($group) => "'{$group->key}': function(){\n" . value($group->onAccepted) . "\n}")->join(",\n") !!} }, - }" x-show="show" x-cloak x-on:cookies-consent.window="show = true">