Files
cm-web-legacy/application/models/life_model.php
2020-06-10 06:19:03 +09:00

39 lines
1.9 KiB
PHP
Executable File

<?php defined('BASEPATH') or exit('No direct script access allowed');
class life_model extends CI_Model
{
public $table = 'life';
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function findById($id)
{
return $this->db->from($this->table . ' l')->where_in('l.idx', $id)
->join('partner p', 'l.partner_idx=p.idx', 'left')
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
}
public function findByEditorId($editorId)
{
return $this->db->from($this->table . ' l')->where_in('l.partner_idx', $editorId)
->join('partner p', 'l.partner_idx=p.idx', 'left')
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views, l.like_count likes, l.comment_count comments, l.*');
}
public function findByCategoryId($categoryId = null)
{
return $this->db->from($this->table . ' l')->where_in('l.category_idx', $categoryId)
->join('partner p', 'l.partner_idx=p.idx', 'left')
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro,
l.title, l.head_title, l.sub_title, l.content, l.category_idx categoryId, l.idx, l.main_img mainImg, l.hit_count views,
l.like_count likes, l.comment_count comments, l.update_date, l.reg_date');
}
}