47 lines
1001 B
PHP
Executable File
47 lines
1001 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class FileModel extends Model
|
|
{
|
|
protected $table = 'files';
|
|
protected $primaryKey = 'id';
|
|
protected $allowedFields = [
|
|
"id",
|
|
"file_name",
|
|
"created_by",
|
|
"is_active",
|
|
"status",
|
|
"reason",
|
|
"action",
|
|
"client_id",
|
|
"policy_id",
|
|
"client_branch_id",
|
|
"uploaded_by"
|
|
];
|
|
|
|
|
|
|
|
public function getFilesDataForDocumentSearch($policy_id, $policy_doc_name)
|
|
{
|
|
$this->select('
|
|
files.action as doc_name,
|
|
files.file_name,
|
|
files.client_id,
|
|
files.policy_id as client_policy_id,
|
|
"uploads" as file_type
|
|
')
|
|
->where('files.policy_id', $policy_id)
|
|
->where('files.is_active', 1);
|
|
|
|
if (!empty($policy_doc_name)) {
|
|
$this->like('files.action', $policy_doc_name);
|
|
}
|
|
|
|
return $this->get()->getResultArray();
|
|
}
|
|
|
|
}
|