<?php
namespace App\Models\Qc;

use App\Models\BaseModel;

class ControlTestsModel extends BaseModel {
    protected $table = 'control_tests';
    protected $primaryKey = 'control_test_id';
    protected $allowedFields = [
        'control_id',
        'test_id',
        'mean',
        'sd',
        'created_at',
        'updated_at',
        'deleted_at'
    ];
    protected $useTimestamps = true;
    protected $useSoftDeletes = true;

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