'Can't rendering data from function mount() laravel livewire
I have some problem in laravel livewire, when I try to bring up data that i define inside mount() function in the class component which the two relate to each other, but the data doesn't show up on view component
public function mount()
{
$this->allOwners = Owner::all();
$this->allVehicles = Vehicle::where('owner_id', $this->owner_id)->get();
$this->allOrders = [
['owner_id' => '', 'vehicle_id' => '', 'bbn_kb' => '']
];
$this->resetPage();
}
@foreach($allOrders as $index => $allOrder)
<x-jet-label for="allOrders[{{ $index }}][owner_id]" value="{{ __('Nama Pemilik') }}"/>
<select wire:model="allOrders.{{ $index }}.owner_id" name="allOrders[{{ $index}}] owner_id]" id="allOrders[{{ $index }}][owner_id]">
@foreach ($allOwners as $owner)
<option value="{{ $owner->id }}">{{ $owner->nama }}</option>
@endforeach
</select>
<x-jet-label for="allOrders[{{ $index }}][vehicle_id]" value="{{ __('Pilih No. Faktur') }}" />
<select wire:model="allOrders.{{ $index }}.vehicle_id" name="allOrders[{{$index}}][vehicle_id]" id="allOrders[{{ $index }}][vehicle_id]">
@foreach ($allVehicles as $vehicle)
<option value="{{ $vehicle->id }}">{{ $vehicle->no_faktur }}</option>
@endforeach
</select>
@endforeach
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
