<?php

namespace App\Models;

use CodeIgniter\Model;

class GalleryModel extends Model
{
    protected $table         = 'galleries';
    protected $primaryKey    = 'id';
    protected $returnType = 'array';
    protected $allowedFields = ['category', 'image', 'caption', 'is_featured', 'sort_order', 'show'];
    protected $useTimestamps = false;
    protected $createdField  = 'created_at';
    protected $updatedField  = null;

    public function getCategories(): array
    {
        return $this->distinct()
                    ->select('category')
                    ->orderBy('category', 'ASC')
                    ->findAll();
    }
}
