61 lines
2.2 KiB
PHP
61 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class ThzMasterModel extends Model
|
|
{
|
|
protected $table = 'thz_master';
|
|
protected $primaryKey = 'thz_id';
|
|
protected $useAutoIncrement = true;
|
|
protected $returnType = 'array';
|
|
protected $useSoftDeletes = false;
|
|
protected $protectFields = true;
|
|
protected $allowedFields = ['name','mobile','email','empcode','policy_no','ticket_type','subject','message','status','assign_to','created_at','updated_at','created_by','updated_by' ,'client_id' ,'policy_id' ,'branch_id'];
|
|
|
|
protected bool $allowEmptyInserts = false;
|
|
|
|
// Dates
|
|
protected $useTimestamps = false;
|
|
protected $dateFormat = 'datetime';
|
|
protected $createdField = 'created_at';
|
|
protected $updatedField = 'updated_at';
|
|
protected $deletedField = 'deleted_at';
|
|
|
|
// Validation
|
|
protected $validationRules = [];
|
|
protected $validationMessages = [];
|
|
protected $skipValidation = false;
|
|
protected $cleanValidationRules = true;
|
|
|
|
// Callbacks
|
|
protected $allowCallbacks = true;
|
|
protected $beforeInsert = [];
|
|
protected $afterInsert = [];
|
|
protected $beforeUpdate = [];
|
|
protected $afterUpdate = [];
|
|
protected $beforeFind = [];
|
|
protected $afterFind = [];
|
|
protected $beforeDelete = [];
|
|
protected $afterDelete = [];
|
|
|
|
public function ticketAutoFetchDetails($client_id ,$mobile){
|
|
|
|
$result = $this->db->table('employees e')
|
|
->select('e.id, e.email_personal,e.email_corporate, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
|
|
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.is_active = 1', 'left')
|
|
->whereIn('e.emp_status', ['active', 'draft', 'enrolled'])
|
|
->where('e.is_active', 1)
|
|
->where('e.mobile', $mobile)
|
|
->where('e.client_id', $client_id)
|
|
->groupBy('e.client_id')
|
|
->get()
|
|
->getResultArray();
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|