<?php

namespace App\Models;

use CodeIgniter\Model;

class SantriModel extends Model
{
    protected $table            = 'santri';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $allowedFields    = ['nis', 'nama', 'kelas', 'asrama', 'wali_id', 'created_at'];

    // Helpful method to get children for a Wali
    public function getByWali($waliId)
    {
        return $this->where('wali_id', $waliId)->findAll();
    }
}
