<?php
namespace App\Models\Master;

use App\Models\BaseModel;

class MasterTestsModel extends BaseModel {
    protected $table = 'master_tests';
    protected $primaryKey = 'test_id';
    protected $allowedFields = [
        'dept_id',
        'name',
        'unit',
        'method',
        'cva',
        'ba',
        'tea',
        'created_at',
        'updated_at',
        'deleted_at'
    ];
    protected $useTimestamps = true;
    protected $useSoftDeletes = true;

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