| Path : /var/www/html/phkaynews-v2/app/Http/Livewire/Frontend/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/phkaynews-v2/app/Http/Livewire/Frontend/SearchPage.php |
<?php
namespace App\Http\Livewire\Frontend;
use App\Models\Post;
use Livewire\Component;
use Livewire\WithPagination;
class SearchPage extends Component
{
use WithPagination;
protected $paginationTheme = 'bootstrap';
public $title;
protected $queryString = ['title'];
public $readyToLoad = false;
public function updatingTitle()
{
$this->gotoPage(1);
}
public function loadPosts()
{
$this->readyToLoad = true;
}
public function render()
{
$posts = Post::publiced()->where('title', 'like', '%' . $this->title . '%')->orderBy('id', 'desc')->paginate(15);
return view('livewire.frontend.search-page', [
'posts' => $this->readyToLoad ? $posts : [],
'perpage' => $posts->perPage()
]);
}
}