feat: Filtro adicionado.
This commit is contained in:
parent
38ea1f7385
commit
1c8f03a45d
|
|
@ -8,16 +8,33 @@
|
||||||
|
|
||||||
class ShowClient extends Component
|
class ShowClient extends Component
|
||||||
{
|
{
|
||||||
|
public $filters = '';
|
||||||
|
public $clients;
|
||||||
|
|
||||||
|
public function mount()
|
||||||
|
{
|
||||||
|
$this->clients = Client::all();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[On('filters-added')]
|
||||||
|
|
||||||
|
public function updatedFilters()
|
||||||
|
{
|
||||||
|
$this->clients = Client::where('name', 'LIKE', '%' . $this->filters . '%')->get();
|
||||||
|
}
|
||||||
|
|
||||||
#[On('client-deleted')]
|
#[On('client-deleted')]
|
||||||
#[On('client-updated')]
|
#[On('client-updated')]
|
||||||
#[On('client-added')]
|
#[On('client-added')]
|
||||||
|
public function refreshClients()
|
||||||
|
{
|
||||||
|
$this->clients = Client::all();
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$clients = Client::all();
|
|
||||||
|
|
||||||
return view('livewire.admin.show-client', [
|
return view('livewire.admin.show-client', [
|
||||||
'clients' => $clients
|
'clients' => $this->clients
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue