35 lines
722 B
PHP
35 lines
722 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Jobs\ArticleDiscoveryJob;
|
|
use App\Models\Article;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
class Articles extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public bool $isRefreshing = false;
|
|
|
|
public function refresh(): void
|
|
{
|
|
$this->isRefreshing = true;
|
|
|
|
ArticleDiscoveryJob::dispatch();
|
|
|
|
$this->dispatch('refresh-started');
|
|
}
|
|
|
|
public function render(): \Illuminate\Contracts\View\View
|
|
{
|
|
$articles = Article::with('feed')
|
|
->orderBy('created_at', 'desc')
|
|
->paginate(15);
|
|
|
|
return view('livewire.articles', [
|
|
'articles' => $articles,
|
|
])->layout('layouts.app');
|
|
}
|
|
}
|