<?php

use app\libraries\Tenants;

defined('BASEPATH') or exit('No direct script access allowed');

class Menu_badge_notification_model extends MY_Model {
    public $short = "menu_badge";
    public $table;
    public $tbl;

    const NAME_RECEIPT = 'receipt';
    const NAME_LEAVE = 'leave';
    const NAME_MAKEUP = 'makeup';
//    public $database;

    public function __construct() {
        parent::__construct();
        $this->database = $this->getTenantNo();
        $this->tbl = 'menu_badge_notification';
        $this->table = $this->tbl . ' ' . $this->short;
    }

    public function unread($name) {
        return $this->saveWhereDB($this->database, $this->tbl, ['unread' => 1], ['name' => $name]);
    }

    public function read($name) {
        return $this->saveWhereDB($this->database, $this->tbl, ['unread' => 0], ['name' => $name]);
    }
}
