<?php
namespace App\Models;

use Core\Model;

class KhsModel extends Model
{
    protected $table = 'tb_khs';

	public function insert($data)
	{
		$sql = "INSERT INTO tb_khs (nim, kode_mk, smt, nilai, mutu, bobot, sks_x_bobot, accept)
				VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
		
		// Pastikan ambil dari $data, dan sediakan default jika tidak ada
		$params = [
			$data['nim'] ?? null,
			$data['kode_mk'] ?? null,
			$data['smt'] ?? null,
			$data['nilai'] ?? 0,
			$data['mutu'] ?? 0,
			$data['bobot'] ?? 0,
			$data['sks_x_bobot'] ?? 0,
			$data['accept'] ?? 1,
		];

		return $this->query($sql, $params);
	}


}
