You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
554 B
PHTML
28 lines
554 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Livewire;
|
||
|
|
||
|
use Livewire\Component;
|
||
|
use App\Http\Controllers\IGDBController;
|
||
|
|
||
|
class SearchDropdown extends Component
|
||
|
{
|
||
|
public $search = '';
|
||
|
public $searchResults = [];
|
||
|
|
||
|
public function selectGame($game)
|
||
|
{
|
||
|
$this->search = '';
|
||
|
$this->emit('gameSelected', $game);
|
||
|
}
|
||
|
|
||
|
public function render()
|
||
|
{
|
||
|
if (strlen($this->search) >= 2) {
|
||
|
$this->searchResults = IGDBController::searchGameByName($this->search);
|
||
|
}
|
||
|
|
||
|
return view('livewire.search-dropdown');
|
||
|
}
|
||
|
}
|