apollodec/Apollo/api/application/models/University_model.php
2017-11-23 19:25:35 +05:30

80 lines
2.5 KiB
PHP

<?php
/**
* Date: 11/9/17
* Time: 5:28 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class University_model extends CI_Model
{
/*
* get university details
* params:
* created by kdk
* */
/*
* get University Details
*/
// get university list
public function get_university_list() {
$this->db->select('*');
$this->db->order_by('CreatedOn', 'DESC');
$this->db->from(UNIVERSITY);
$univDetails = $this->db->get();
$universityDetails = $univDetails->result();
if (count($universityDetails) > 0) {
$results['univList'] = true;
$results['university_details'] = $universityDetails;
} else {
$results['univList'] = false;
$results['message'] = 'No record found';
}
return $results;
}
// update univesity details
public function update_university_details($updateFor, $Arr) {
$this->db->where('UniversityID', $updateFor);
$this->db->update(UNIVERSITY, $Arr);
if ($this->db->affected_rows() == '1') {
$result['updateUniversityStatus'] = true;
$result['message'] = "Successfully University details Updated";
} else {
$result['updateUniversityStatus'] = false;
$result['message'] = "Successfully University details Updated";
}
return $result;
}
// check exist details
public function check_Univ_Exist($data, $check) {
// check update for mobile number
$this->db->select('*');
$this->db->from(UNIVERSITY);
$this->db->where('UniversityID', $data);
if ($this->db->get()->first_row()) {
$result['existUniv'] = true;
$result['message'] = "This University Id is already exist!";
} else {
$result['existUniv'] = false;
}
return $result;
}
// add university details
public function insert_Univ($arr) {
$this->db->insert(UNIVERSITY, $arr);
if ($this->db->affected_rows() == '1') {
$result['addUniv'] = true;
$result['message'] = "Successfully University details added";
} else {
$result['addUniv'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
}