nyaabooru/app/Livewire/Posts/Index.php
Jaiden f60ae41bf6
Some checks failed
Docker / build (push) Has been cancelled
better image uploading & user roles
2025-08-09 23:01:27 -04:00

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');
}
}