diff --git a/app/Livewire/BlogRenderer.php b/app/Livewire/BlogRenderer.php index 3f75db2..4fd7132 100644 --- a/app/Livewire/BlogRenderer.php +++ b/app/Livewire/BlogRenderer.php @@ -2,11 +2,21 @@ namespace App\Livewire; +use Illuminate\View\View; use Livewire\Component; +use App\Models\Blog; class BlogRenderer extends Component { - public function render() + public $blogs; + + public function mount(): void + { + // Fetch all blogs with their related users and images + $this->blogs = Blog::with(['user', 'images'])->orderBy('created_at', 'desc')->get(); + } + + public function render(): View { return view('livewire.blog-renderer'); }