<?php

declare(strict_types=1);


namespace App\Blog\Controllers;

use App\Models\Post;

class HomeController extends Controller
{
    public function index()
    {
        $posts = Post::query()
            ->published()
            ->orderByDesc('is_sticky')
            ->latest('published_at')
            ->paginate((int) blog_setting('per_page', config('blog.per_page')));

        return theme_view('index', compact('posts'));
    }
}
