Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TiboriusDev's avatar

Hide Livewire data in alpine

@foreach ( $dates as $date )
			<li class="flex flex-col bg-slate-100 rounded overflow-hidden"
				x-data="{
					yourChoise: 0,
				}"
				x-init="
				$nextTick(() => {
					for( const dateMember of {{ $date->dateMember }}){
						if( dateMember.member_id == $wire.entangle('memberId').initialValue ){
							yourChoise = dateMember.vote;
							return
						}
					}
				})"
			>

Is there any way that I can get {{ $date->dateMember }} not output as plain text. When I look at my HTML code in the Dev Console, I see all the data that is output.

I don't have the problem with $wire.entangle('memberId').initialValue, but I can't apply $wire.entangle to $date->dateMember

Laravel 11.13 Livewire 3.5.2

0 likes
1 reply
Snapey's avatar

nothing is private that you share with the client.

Please or to participate in this conversation.