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

Wakanda's avatar
Level 10

Show selected option in livewire not working

hi, devs, Show selected option in livewire not working but if I remove the wire model it works like a charm but then in does not save data

<select wire:model="currency" style="border: none !important;">
	@foreach($currencies as $currency)
		<option value="{{ $currency->id }}" {{ $selectedCurrency->name == session('currency')['name'] ? 
                       'selected="selected"' : '' }}>{{ $currency->name }}</option> 
	@endforeach
</select>
0 likes
3 replies
Wakanda's avatar
Wakanda
OP
Best Answer
Level 10

Fixed

all I had to do was to set value in mount method like this

public function mount(){
   $this->currency = 1;  // make this dynamic
}
1 like

Please or to participate in this conversation.