<?php
namespace App\Models;

class CourseRepository extends BaseRepository {
    public function published(): array {
        return $this->fetchAll("SELECT * FROM courses WHERE is_published = 1 ORDER BY is_featured DESC, title");
    }

    public function findBySlug(string $slug): ?array {
        return $this->fetchOne("SELECT * FROM courses WHERE slug = ?", [$slug]);
    }
}
