Hey there!
I recently spun up a new Laravel v12.4.1 app with Livewire v3.6.2 and am having trouble with 419 errors when using wire:click on a button.
I have a resources/views/thing-recorder/show.blade.php file that imports a layout found at resources/views/components/layouts/thing-recorder.blade.php. In the layout, I have the following in my <head>: <meta name="csrf-token" content="{{ csrf_token() }}"> along with @livewireStyles (@livewireScripts is the last thing before </body>).
In the show blade template, I bring in a Livewire component as such: <livewire:thing-recorder.panel :breakdown="$breakdown" />
In that component, I have a with wire:click="selectWorkflow('{{ $workflow->id }}')"
In app/Livewire/ThingRecorder/Panel.php I have a selectWorkflow method.
Here's the kicker: when I leave bootstrap/app.app as-is, I get a 419 error every time I try and click this button. However, I read online that you can modify it by adding this to the "withMiddleware" section to get around my problem: $middleware->validateCsrfTokens(except: ['livewire/*']);
When I add this, it works! However, it seems like this is really sketchy to disable CSRF in any case. With that said, I've read repeatedly online that "Livewire doesn't use CSRF," which is making me question if this is indeed sketchy or just necessary?
Thoughts?