<?php class Booking_model extends CI_Model { public function _consruct(){ parent::_construct(); } function get_allbooking(){ $query = $this->db->get('booking'); $result = $query->result(); return $result; } function view_popup_all($id){ $this->db->select("TRIM(concat(users.first_name,' ',IFNULL(users.last_name,''))) as user_name,booking.*"); $this->db->join('ride','ride.id = booking.ride_id'); $this->db->join('users','users.id = ride.users_id','left'); $query = $this->db->where('booking.id', $id); //$query = $this->db->where('status',0); $query = $this->db->get('booking'); $result = $query->row(); return $result; } // function get_completedbooking(){ // $query = $this->db->where('status',3); // $query = $this->db->get('booking'); // $result = $query->result(); // return $result; // } // function view_popup_completed($id){ // $query = $this->db->where('id', $id); // $query = $this->db->where('status',3); // $query = $this->db->get('booking'); // $result = $query->row(); // return $result; // } function get_completedbooking(){ $query = $this->db->where('status',2); $query = $this->db->get('booking_approve'); $result = $query->result(); return $result; } function view_popup_completed($id){ $this->db->select("TRIM(concat(users.first_name,' ',IFNULL(users.last_name,''))) as user_name,booking_approve.*"); $this->db->join('users','users.id = booking_approve.driver_id'); $this->db->where('booking_approve.id', $id); //$query = $this->db->where('status',0); $this->db->where('status',2); $query = $this->db->get('booking_approve'); $result = $query->row(); return $result; /* $query = $this->db->where('id', $id); $query = $this->db->where('status',2); $query = $this->db->get('booking_approve'); $result = $query->row(); return $result; */ } function get_cancelleddbooking(){ $query = $this->db->where('status',2); $query = $this->db->get('booking'); $result = $query->result(); return $result; } function view_popup_cancelled($id){ $this->db->select("TRIM(concat(users.first_name,' ',IFNULL(users.last_name,''))) as user_name,booking.*"); $this->db->join('ride','ride.id = booking.ride_id'); $this->db->join('users','users.id = ride.users_id'); $query = $this->db->where('booking.id', $id); $query = $this->db->where('status',2); //$query = $this->db->where('status',0); $query = $this->db->get('booking'); $result = $query->row(); return $result; /* $query = $this->db->where('id', $id); $query = $this->db->where('status',2); $query = $this->db->get('booking'); $result = $query->row(); return $result; */ } function get_onprocessdbooking(){ $query = $this->db->where('status',4); $query = $this->db->get('booking'); $result = $query->result(); return $result; } function view_popup_onprocess($id){ $query = $this->db->where('id', $id); $query = $this->db->where('status',4); $query = $this->db->get('booking'); $result = $query->row(); return $result; } // function get_approvedbooking(){ // $query = $this->db->where('status',1); // $query = $this->db->get('booking_approve'); // $result = $query->row(); // $query1 = $this->db->where(ride_id,$result->ride_id); // $query1= $this->db->get('booking'); // echo $this->db->last_query(); // die(); // $result1 = $query->result(); // return $result1; // } function get_approveddbooking(){ $query = $this->db->where('status',1); $query = $this->db->get('booking_approve'); $result = $query->result(); // echo $this->db->last_query(); // die(); return $result; } } ?>