<?php

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

class Hosting_package_model extends CI_Model{

    function insert_hosting_package($data){

        $query = $this->db->insert('packages',$data);

        if($query){
            return TRUE;
        }
        else{
            return FALSE;
        }

    }

    function show_shared_hosting_package(){
        $query = $this->db->get_where('packages', array('type' => 'shared_hosting'));
        $res = $query->result_array();
        return $res;
    }

    function show_wordpress_hosting_package(){
        $query = $this->db->get_where('packages', array('type' => 'wordpress_hosting'));
        $res = $query->result_array();
        return $res;
    }

    function show_email_marketing_package(){
        $query = $this->db->get_where('packages', array('type' => 'email_marketing'));
        $res = $query->result_array();
        return $res;
    }

    function show_facebook_marketing_package(){
        $query = $this->db->get_where('packages', array('type' => 'fb_packages'));
        $res = $query->result_array();
        return $res;
    }

    function show_google_adwords_package(){
        $query = $this->db->get_where('packages', array('type' => 'google_adwords'));
        $res = $query->result_array();
        return $res;
    }
    


    function show_hosting_package(){

		$query = $this->db->get('packages');
		$res = $query->result_array();
	 	return $res;

    }

    function single_hosting_package($data){

        $query = $this->db->get_where('packages', array('packageid' => $data['packageid']));
        $res = $query->result_array();
        return $res;
        
    }

    function update_hosting_package($data){
        $array = array(
            'title' => $data['title'],
            'price' => $data['price'],
            'type' => $data['type'],
            'description' => $data['description']
        );
        $this->db->where('packageid', $data['packageid']);
        $query = $this->db->update('packages', $array);
        if($query){
            return TRUE;
        }
        else{
            return FALSE;
        }
    }

    function delete_hosting_package($data){
        
        $query = $this->db->delete('packages', array('packageid' => $data['packageid']));

        if($query){
            return TRUE;
        }
        else{
            return FALSE;
        }
    }
    
    // function update_front_countdown($data){
    //     $array = array(
    //         'total_experience' => $data['total_experience'],
    //         'happy_clients' => $data['happy_clients'],
    //         'projects_done' => $data['projects_done']
    //     );
    
    //     $this->db->where('front_countdownid', $data['front_countdownid']);
    //     $query = $this->db->update('front_countdown', $array);

    //     if($query){
    //         return TRUE;
    //     }
    //     else{
    //         return FALSE;
    //     }
    // }

}

?>