mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-09 21:42:57 +00:00
30 lines
502 B
PHP
30 lines
502 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Posts;
|
|
|
|
use App\Models\Post;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
class Index extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public $posts = [];
|
|
|
|
public function mount()
|
|
{
|
|
$this->posts = Post::orderBy('created_at', 'desc')->get();
|
|
}
|
|
|
|
#[Title('Posts')]
|
|
public function render()
|
|
{
|
|
if ($this->posts->count() == 0)
|
|
{
|
|
return view('livewire.posts.index-empty');
|
|
}
|
|
return view('livewire.posts.index');
|
|
}
|
|
}
|