<?php

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

class Software_model extends CI_Model{

    function insert_software($data){

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

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

    }

    function update_software($data){

        $data = array(
            'title' => $data['title'],
            'description' => $data['description']
        );
        
        $this->db->where('softwareid', $data['softwareid']);
        $this->db->update('softwares', $data);

        $query = $this->db->update('softwares',$data);

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

    }

    function single_software($data){

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

    }


    function show_software(){

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

    }

    function delete_software($data){
        unlink(FCPATH . $data['picture_path']);
        $query = $this->db->delete('softwares', array('softwareid' => $data['softwareid']));

        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;
    //     }
    // }

}

?>