66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php if (!defined('BASEPATH')) {
|
|
exit('No direct script access allowed');
|
|
}
|
|
|
|
class Resetpassword_model extends CI_Model {
|
|
|
|
private $read_replica;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->read_replica = $this->load->database('savvy_replica', TRUE);
|
|
}
|
|
|
|
public function get_resetpassword_records(
|
|
$filters = [],
|
|
$limit = null,
|
|
$offset = null
|
|
) {
|
|
|
|
$combo_array = [
|
|
'status'
|
|
];
|
|
|
|
$this->read_replica->select([
|
|
'*'
|
|
]);
|
|
|
|
$this->read_replica->from('resetpassword');
|
|
|
|
foreach($filters as $key => $val) {
|
|
|
|
$key = $key === 'loc' ? "TEXT($key)" : $key;
|
|
|
|
if (in_array($key, $combo_array)) {
|
|
|
|
$this->read_replica->where($key, $val);
|
|
|
|
} else if ($key === 'member_id') {
|
|
|
|
$this->read_replica->where($key, $val);
|
|
|
|
} else if (strpos($key, 'from') !== FALSE) {
|
|
|
|
$this->read_replica->where('DATE(created) >=', $val);
|
|
|
|
} else if (strpos($key, 'to') !== FALSE) {
|
|
|
|
$this->read_replica->where('DATE(created) <=', $val);
|
|
|
|
} else {
|
|
|
|
$this->read_replica->like('lower(' . $key . ')', strtolower($val));
|
|
|
|
}
|
|
}
|
|
|
|
if ($limit) {
|
|
$this->read_replica->limit($limit, $offset);
|
|
}
|
|
|
|
$this->read_replica->order_by('id ASC');
|
|
|
|
return $this->read_replica->get()->result_array();
|
|
}
|
|
} |