<?php namespace App\Models;
/**
 * File			: MenuModel.php
 * Description  : Model untuk halaman menu
 * Created By	: Hendi
 * Created Date : 15 Mar 2021
 * Last Update  : 04 Apr 2021
**/
use CodeIgniter\Model;
 
class MenuModel extends Model
{
    protected $table = 'menu';
	protected $primaryKey = 'menu_id';
    protected $allowedFields = ['menu_id', 'menu_name', 'slug', 'unit', 'price', 'description'];
    
    # fungsi untuk cek is_unique menu_id
	public function cekMenuID($id) 
	{
		return $this->builder()->selectCount('menu_id')
			->where('menu_id', $id)
			->countAllResults(); 
	}
}