29 lines
737 B
PHP
Executable File
29 lines
737 B
PHP
Executable File
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class comment_model extends CI_Model
|
|
{
|
|
|
|
public $table = 'comment';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
public function find($alias = true) {
|
|
return $this->db->from($this->table. ($alias ? ' cmt' : ''));
|
|
}
|
|
|
|
public function findById($commentId) {
|
|
return $this->db->where('idx', $commentId)->get($this->table)->row();
|
|
}
|
|
|
|
public function findByContentTypeAndContentId($type, $id) {
|
|
return $this->db->from($this->table. ' c')
|
|
->where('content_type', $type)
|
|
->where('content_idx', $id);
|
|
}
|
|
|
|
}
|