mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-09 21:42:57 +00:00
29 lines
561 B
PHP
29 lines
561 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\User;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Component;
|
|
use Spatie\Searchable\ModelSearchAspect;
|
|
use Spatie\Searchable\Search as SpatieSearch;
|
|
|
|
class Search extends Component
|
|
{
|
|
#[Validate('string|min:3')]
|
|
public string $searchText = '';
|
|
|
|
public $searchResults = [];
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.search');
|
|
}
|
|
|
|
public function updated()
|
|
{
|
|
$this->searchResults = (new SpatieSearch())
|
|
->registerModel(User::class, 'name')
|
|
->perform($this->searchText);
|
|
}
|
|
}
|