Files
riksdagen-app/app/Livewire/Person/Search.php
2025-12-20 15:43:22 +01:00

37 lines
738 B
PHP

<?php
namespace App\Livewire\Person;
use Livewire\Component;
use App\Services\RiksdagenService;
use App\Enums\PartyEnum;
class Search extends Component
{
public $firstName = '';
public $lastName = '';
public $party = '';
public $results = [];
public $parties = [];
public function mount()
{
$this->parties = PartyEnum::cases();
}
public function search()
{
$service = app(RiksdagenService::class);
$this->results = $service->searchPerson(
firstName: $this->firstName,
lastName: $this->lastName,
party: $this->party
)->original;
}
public function render()
{
return view('livewire.person.search');
}
}