So I have a component, with Class and view separate. in class on mount i do
$c. = Model::query()...
and use that in view just fine.
The issue is if i do .. nothing happens, if i submit a form, it just refreshes the page?
I have created a new LARAVEL install with livewire.. i tried adding @livewireScripts as those were missing and no luck..
[I do have a livewire3 app which is working fine, and i cant see any major diff between that and this, apart from in composer.json where this new app explicitly requires livewire.. wheras in the old one i just see livewire/volt entry, and yes i have tried to duplicate that in my new app.. [
also initially i created the new livewire pages:: (with anon class at the top, view at bottom ,kinda like vueJS setup) and that didnt work either..
new class extends Component
{
public ?int $countryId = null;
public ?int $typeId = null;
public ?string $search = null;
public $countries;
public $types;
public $results;
public function mount()
{
$this->countries = ''
$this->types = ''
$this->countryId = ''
$this->search();
}
public function updatedCountryId($value)
{
info('updating country id');
}
public function search()
{
$this->results = R::get();
}
};
?>
<div>
<div class="filters">
<form wire:submit.prevent='search'>
<label>Countries</label>
<select wire:model='countryId'>
<option value="">--Select--</option>
@foreach ($countries as $country)
<option value="{{ $country->id }}" >
{{ $country->name }}
</option>
@endforeach
</select>
<label>Category</label>
<select wire:model='typeId'>
<option value="">--Select--</option>
@foreach ($types as $type)
<option
@selected($typeId === $type->id)
value="{{ $type->id }}"
>
{{ $type->name }}
</option>
@endforeach
</select>
<label>Search</label>
<input wire:model='search'/>
<input type="submit" value="search" wire:click='search'/>
</form>
</div>
<div class="results">
@foreach ($results as $result)
<div class="result">
///
</div>
@endforeach
</div>
</div>