<?php

namespace App\Models;

use CodeIgniter\Model;

class VenueModel extends Model
{


    function get_all_booking()
    {
        return $this->db->table('venue_booking')
        ->get()
        ->getResult();
    }

    function get_all_booking_by_added_by($id)
    {
        return $this->db->table('venue_booking')
        ->where('venue_added_by', $id)
        ->get()
        ->getResult();
    }

    public function add_booking($data)
    {
        return $this->db->table('venue_booking')
        ->insert($data);
    }

    public function get_venue_by_id($id)
    {
        return $this->db->table('venue_booking')
        ->where('venue_id', $id)
        ->get()
        ->getRow();
    }

    public function update_booking($data, $id)
    {
        return $this->db->table('venue_booking')
        ->where('venue_id', $id)
        ->update($data);
    }

    public function delete_venue($id)
    {
        return $this->db->table('venue_booking')
        ->where('venue_id', $id)
        ->delete();
    }

    public function check_venue_avaliblity($date)
    {
        return $this->db->table('venue_booking')
        ->where('venue_wedding_date', $date)
        ->get()
        ->getNumRows();
    }

   
}
