Initial commit
This commit is contained in:
36
app/Livewire/Person/Search.php
Normal file
36
app/Livewire/Person/Search.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user