Use meilisearch in nav search
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Models\Gallery;
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -18,22 +17,15 @@ class NavLiveSearch extends Component
|
||||
public function render()
|
||||
{
|
||||
$episodes = [];
|
||||
$randomimage = null;
|
||||
if ($this->navSearch != '') {
|
||||
$episodes = Episode::with('gallery')->where('title', 'like', '%'.$this->navSearch.'%')
|
||||
->orWhere('title_jpn', 'like', '%'.$this->navSearch.'%')
|
||||
->when(Auth::guest(), fn ($query) => $query->withoutTags(['loli', 'shota']))
|
||||
->take(10)
|
||||
$episodes = Episode::search($this->navSearch)
|
||||
->when(Auth::guest(), fn ($query) => $query->whereNotIn('tags', ['Loli', 'Shota']))
|
||||
->take(7)
|
||||
->get();
|
||||
|
||||
$randomimage = Gallery::all()
|
||||
->random(1)
|
||||
->first();
|
||||
}
|
||||
|
||||
return view('livewire.nav-live-search', [
|
||||
'episodes' => $episodes,
|
||||
'randomimage' => $randomimage,
|
||||
'query' => $this->navSearch,
|
||||
'hide' => empty($this->navSearch),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user