mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
This commit is contained in:
parent
21e59d775a
commit
f60ae41bf6
26 changed files with 741 additions and 70 deletions
|
|
@ -3,9 +3,7 @@
|
|||
namespace App\Livewire\Posts;
|
||||
|
||||
use App\Models\Post;
|
||||
use App\Models\Tag;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
|
|
@ -13,11 +11,20 @@ class Index extends Component
|
|||
{
|
||||
use WithPagination;
|
||||
|
||||
public $posts = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->posts = Post::orderBy('created_at', 'desc')->get();
|
||||
}
|
||||
|
||||
#[Title('Posts')]
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.posts.index', [
|
||||
'posts' => Post::orderBy('created_at', 'desc')->paginate(25),
|
||||
]);
|
||||
if ($this->posts->count() == 0)
|
||||
{
|
||||
return view('livewire.posts.index-empty');
|
||||
}
|
||||
return view('livewire.posts.index');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue