<?php
namespace App\Models\Master;

use App\Models\BaseModel;

class MasterDeptsModel extends BaseModel {
    protected $table = 'master_depts';
    protected $primaryKey = 'dept_id';
    protected $allowedFields = [
        'dept_name',
        'created_at',
        'updated_at',
        'deleted_at'
    ];
    protected $useTimestamps = true;
    protected $useSoftDeletes = true;

    public function search($keyword = null) {
        if ($keyword) {
            return $this->groupStart()
                ->like('dept_name', $keyword)
                ->groupEnd()
                ->findAll();
        }
        return $this->findAll();
    }
}
