F
Filament15mo ago
Vp

Custom livewire in render-hook not working

I create a livewire page artisan make:livewire test, and inside test I assign variable like below
class Test extends Component
{
public $query = 'abc';

public function render()
{
return view('livewire.test');
}
}
class Test extends Component
{
public $query = 'abc';

public function render()
{
return view('livewire.test');
}
}
And in blade file
<div>
{{ $query }} // this throw error

<x-filament::input.wrapper suffix-icon="heroicon-m-globe-alt">
<x-filament::input
type="url"
wire:model="query"
/>
</x-filament::input.wrapper>
</div>
<div>
{{ $query }} // this throw error

<x-filament::input.wrapper suffix-icon="heroicon-m-globe-alt">
<x-filament::input
type="url"
wire:model="query"
/>
</x-filament::input.wrapper>
</div>
I create render hook and call this like
return $panel
->renderHook(
'panels::global-search.before',
fn (): View => view('livewire.test'),
)
return $panel
->renderHook(
'panels::global-search.before',
fn (): View => view('livewire.test'),
)
But I always get Undefined variable $query. What should be the problem?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server