first commit
This commit is contained in:
49
application/models/User_model.php
Executable file
49
application/models/User_model.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php if (!defined('BASEPATH')) {
|
||||
exit('No direct script access allowed');
|
||||
}
|
||||
|
||||
|
||||
class User_model extends MY_Model
|
||||
{
|
||||
|
||||
private $db;
|
||||
private $table = 'cm_user';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db = &get_instance()->db;
|
||||
}
|
||||
|
||||
private function init()
|
||||
{
|
||||
return $this->db->from('cm_user');
|
||||
}
|
||||
|
||||
public function getOne($seq)
|
||||
{
|
||||
return self::init()->where_in("seq", $seq)->get()->row();
|
||||
}
|
||||
|
||||
public function findByUserName($userName)
|
||||
{
|
||||
return $this->init()->where('userName', $userName)
|
||||
->get()->result();
|
||||
}
|
||||
|
||||
public function findByEmail($email)
|
||||
{
|
||||
return $this->init()->where('email', $email)
|
||||
->get()->result();
|
||||
}
|
||||
|
||||
public function save($data)
|
||||
{
|
||||
return $this->db->insert_batch('cm_user', is_array($data) ? $data : [$data]);
|
||||
}
|
||||
|
||||
public function getAdminSiteUsers()
|
||||
{
|
||||
return $this->db->where_in('roleID', [2, 5, 7])->get($this->table)->result();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user