mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
RESTv1
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Studiengang_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'tbl_studiengang';
|
||||
public $id = '';
|
||||
public $order = 'DESC';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
// get all
|
||||
function get_all()
|
||||
{
|
||||
$this->db->order_by($this->id, $this->order);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
|
||||
// get data by id
|
||||
function get_by_id($id)
|
||||
{
|
||||
$this->db->where($this->id, $id);
|
||||
return $this->db->get($this->table)->row();
|
||||
}
|
||||
|
||||
// get total rows
|
||||
function total_rows() {
|
||||
$this->db->from($this->table);
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
// get data with limit
|
||||
function index_limit($limit, $start = 0) {
|
||||
$this->db->order_by($this->id, $this->order);
|
||||
$this->db->limit($limit, $start);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
|
||||
// get search total rows
|
||||
function search_total_rows($keyword = NULL) {
|
||||
$this->db->like('', $keyword);
|
||||
$this->db->from($this->table);
|
||||
return $this->db->count_all_results();
|
||||
}
|
||||
|
||||
// get search data with limit
|
||||
function search_index_limit($limit, $start = 0, $keyword = NULL) {
|
||||
$this->db->order_by($this->id, $this->order);
|
||||
$this->db->like('', $keyword);
|
||||
$this->db->limit($limit, $start);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
|
||||
// insert data
|
||||
function insert($data)
|
||||
{
|
||||
$this->db->insert($this->table, $data);
|
||||
}
|
||||
|
||||
// update data
|
||||
function update($id, $data)
|
||||
{
|
||||
$this->db->where($this->id, $id);
|
||||
$this->db->update($this->table, $data);
|
||||
}
|
||||
|
||||
// delete data
|
||||
function delete($id)
|
||||
{
|
||||
$this->db->where($this->id, $id);
|
||||
$this->db->delete($this->table);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file Studiengang_model.php */
|
||||
/* Location: ./application/models/Studiengang_model.php */
|
||||
Reference in New Issue
Block a user