50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ModelArtikel extends CI_Model
|
|
{
|
|
protected $table = 'general_consent';
|
|
protected $primaryKey = 'id';
|
|
protected $returnType = 'object';
|
|
|
|
/**
|
|
|
|
* @author Fendrik Nurul Jadid <fendrik1311@gmail.com>
|
|
|
|
* @since v.1.0
|
|
|
|
**/
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
//Codeigniter : Write Less Do More
|
|
}
|
|
|
|
public function get_data()
|
|
{
|
|
return $this->db->get_where("artikel")->result();
|
|
}
|
|
|
|
public function insert($data)
|
|
{
|
|
return $this->db->table($this->table)->insert($data);
|
|
}
|
|
public function count_artikel()
|
|
{
|
|
return $this->db->count_all("artikel");
|
|
}
|
|
public function get_data_edit($id)
|
|
{
|
|
$result = $this->db->get_where("artikel", array("id_artikel" => $id))->row_array();
|
|
|
|
if ($result !== null) {
|
|
return $result;
|
|
} else {
|
|
// Handle the case where no matching data was found, e.g., by returning an empty array or showing an error message.
|
|
return array(); // You can customize this based on your requirements.
|
|
}
|
|
}
|
|
|
|
}
|