class Model
public
|
|
get_vars()
|
No description | |
public
|
|
save()
|
No description | |
public
|
|
get($columns = [], $where = [])
|
No description | |
public
|
|
find($tag = '*', $where = [])
|
No description | |
public
|
|
update($update = [], $where = [])
|
No description | |
public
|
|
remove($where = [])
|
No description |
get_vars()public get_vars()
save()public save()
get()public get($columns = [], $where = [])
$columns |
||
$where |
find()public find($tag = '*', $where = [])
$tag |
||
$where |
update()public update($update = [], $where = [])
$update |
||
$where |
remove()public remove($where = [])
$where |
<?php
namespace App\Khan\Component\DB;
use App\Khan\Component\DB\DB as DB;
class Model {
private function db(){
return DB::getConn($_ENV);
}
public function get_vars(){
return get_object_vars($this);
}
public function save(){
$data = $this->db()->insert($this::table, $this->get_vars());
return $data->rowCount();
}
public function get($columns = [], $where = []){
return $this->db()->get($this::table, $columns, $where);
}
public function find($tag = '*', $where = []){
return $this->db()->select($this::table, $tag, $where);
}
public function update($update = [], $where = []){
return $this->db()->update($this::table, $update, $where);
}
public function remove($where = []){
return $this->db()->delete($this::table, $where);
}
}