<?php

namespace App\Models;

use CodeIgniter\Model;

class MajorModel extends Model
{
    protected $table            = 'majors';
    protected $primaryKey       = 'id';

    protected $allowedFields    = [
        'code',
        'name',
        'level',
        'quota',
        'description',
        'is_active'
    ];

    protected $useTimestamps = true;
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';

    protected $returnType = 'array';

    public function active()
    {
        return $this->where('is_active', 1)->findAll();
    }
}
