mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
Add post deletion w/ confirmation, search (broken), profile page
This commit is contained in:
parent
bfb497c367
commit
827d125639
21 changed files with 374 additions and 27 deletions
29
app/Livewire/Search.php
Normal file
29
app/Livewire/Search.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue