MIF_E31211906/SistemPeramalanDBD/app/Models/ModelH1.php

42 lines
918 B
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
use Codeigniter\HTTP\RequestInterface;
class ModelH1 extends Model
{
protected $db;
protected $request;
public function __construct()
{
$this->db = \Config\Database::connect();
$this->request = \Config\Services::request();
}
protected $table = 'demam_hasil';
protected $primaryKey = 'id';
protected $returnType = 'object';
protected $allowedFields = ['id','Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
public function getDarah()
{
return $this->orderBy('id', 'DESC')->get();
}
public function insert_darah($data)
{
return $this->db->table($this->table)->insert($data);
}
public function getById($id)
{
return $this->where(['id' => $id])->get();
}
}