# Model

class Model

## Methods

`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 |

## Details

at line 12

### `get_vars()`

`public get_vars()`
at line 16

### `save()`

`public save()`
at line 21

### `get()`

`public get($columns = [], $where = [])`

#### Parameters

| `$columns` |
| `$where` |

at line 25

### `find()`

`public find($tag = '*', $where = [])`

#### Parameters

| `$tag` |
| `$where` |

at line 29

### `update()`

`public update($update = [], $where = [])`

#### Parameters

| `$update` |
| `$where` |

at line 33

### `remove()`

`public remove($where = [])`

#### Parameters

| `$where` |

## Source code

    <?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);
    		}

    	}