33 lines
729 B
PHP
33 lines
729 B
PHP
<?php
|
||
|
||
namespace App\Livewire;
|
||
|
||
use App\Models\Blog;
|
||
use App\Models\Post;
|
||
use Livewire\Component;
|
||
use Livewire\Attributes\Url;
|
||
use Livewire\WithPagination;
|
||
use Livewire\WithoutUrlPagination;
|
||
|
||
class Search extends Component
|
||
{
|
||
use WithPagination, WithoutUrlPagination;
|
||
|
||
public $search = '';
|
||
|
||
public $showMenu = false;
|
||
|
||
public function refreshsearch()
|
||
{
|
||
$this->resetPage();
|
||
}
|
||
|
||
public function render()
|
||
{
|
||
$kName = htmlspecialchars_decode($this->search, ENT_QUOTES);
|
||
$search = str_replace('', '***', $kName);
|
||
$this->showMenu = true;
|
||
return view('livewire.search', ['blogsSearchs' => Blog::where('content', 'like', '%' . $search . '%')->paginate(5)]);
|
||
}
|
||
}
|