<?php

namespace App\Models;

use CodeIgniter\Model;

class StudyProgramModel extends Model
{
    protected $table         = 'study_programs';
    protected $primaryKey    = 'id';
    protected $returnType    = 'array';
    protected $useTimestamps = true;
    protected $allowedFields = ['name', 'code'];

    public function getDropdown(): array
    {
        $rows = $this->orderBy('name', 'ASC')->findAll();
        $list = [];
        foreach ($rows as $row) {
            $list[$row['id']] = $row['name'];
        }
        return $list;
    }
}
