<?php

namespace App\Models;

use CodeIgniter\Model;

class ContactModel extends Model
{
    protected $db;
    protected $contact_message            = 'contact_message';
    
    function get_all_message()
    {
        return $this->db->table($this->contact_message)->get()->getResult();
    }
    function delete_message($id)
    {
        return $this->db->table($this->contact_message)
        ->where(['id'=> $id])
        ->delete();
    }
    function get_message_by_id($id)
    {
        return $this->db->table($this->contact_message)
        ->where('id', $id)
        ->get()
        ->getRow();
    }

    function add_new_content_message($data)
    {
        return $this->db->table($this->contact_message)
        ->insert($data);
    }

    function update_is_reply($data, $id)
    {
        return $this->db->table($this->contact_message)
        ->where('id', $id)
        ->update($data);
    }
}
