| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetie_hellogtx/application/modules/testimonial/models/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class ApplicationStatusModel extends CI_Model {
public $tableName = 'bank_application';
function create() {
$this->db->where('application_id', $this->input->post('applicationId'));
$this->db->where('bank_id', $this->session->user_id);
$this->db->where('status', $this->input->post('status'));
$sql = $this->db->get($this->tableName);
if($sql->num_rows() > 0) {
$this->output->set_status_header(400);
return json_encode(['message' => 'You already accpted this lead, Please check in Recived bucket list', 'status' => 'failed']);
}
$arr = array(
'id' => uniqid(),
'application_id' => $this->input->post('applicationId'),
'bank_id' => $this->session->user_id,
'status' => $this->input->post('status'),
'created_at' => global_datetime(),
);
$userdetail = [];
if(!empty($this->session->company)) {
$userdetail = (array)$this->session->company;
unset( $userdetail['password']);
}
$arr['created_by'] = json_encode($userdetail);
$this->db->insert($this->tableName, $arr);
if( $this->db->affected_rows() > 0 ) {
return json_encode(['message' => 'Created successfully', 'status' => 'success']);
} else {
$this->output->set_status_header(400);
return json_encode(['message' => 'Unknown Error', 'status' => 'failed']);
}
}
function update() {
if(empty($this->session->user_id)) {
$this->output->set_status_header(401);
return json_encode(['message' => 'Unauthorized action', 'status' => 'failed']);
}
$arr = array(
'status' => $this->input->post('status'),
'loan_number' => $this->input->post('loan_number'),
'updated_at' => global_datetime(),
);
$this->db->where('application_id', $this->input->post('applicationId'));
$this->db->where('bank_id', $this->session->user_id);
$this->db->update($this->tableName, $arr);
if( $this->db->affected_rows() > 0 ) {
return json_encode(['message' => 'Created successfully', 'status' => 'success']);
} else {
$this->output->set_status_header(400);
return json_encode(['message' => 'Unknown Error', 'status' => 'failed']);
}
}
}