bb_sign/app/Models/ClientDocsModel.php
bitbucket 5087ed1aff GWM
2024-05-31 16:21:01 +05:30

48 lines
1.7 KiB
PHP

<?php namespace App\Models;
use CodeIgniter\Model;
class ClientDocsModel extends Model
{
protected $table = 'client_docs';
protected $primaryKey = 'id';
protected $allowedFields = ['client_id','template_id','is_active' ,'created_by','updated_by'];
public function getTemplate($client_id){
$this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id , services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id');
$this->where('client_docs.is_active', 1);
$this->where('client_docs.client_id', $client_id);
return $this->findAll();
}
public function getDocs($client_id){
$this->select('template.template_name , template.template_id ,client_docs.is_approved ,client_docs.id as doc_id ,client_docs.is_active, services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id');
$this->where('client_docs.client_id', $client_id);
return $this->findAll();
}
public function docPreview($doc_id){
$this->select('client_docs.is_approved ,client_docs.id as doc_id,client_docs.client_id ,client_docs.updated_at,template.template_name,template.body_html , services.service_name');
$this->join('template', 'template.template_id = client_docs.template_id');
$this->join('services', 'services.service_id = template.service_id');
$this->where('client_docs.id', $doc_id);
return $this->get()->getRow();
}
}