40 lines
879 B
PHP
40 lines
879 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use App\Models\EmployeeModel;
|
|
use App\Models\EmployeePolicyModel;
|
|
use App\Models\TicketMasterModel;
|
|
|
|
class clientWebHookHelper
|
|
{
|
|
protected $empModel;
|
|
protected $empPolicyModel;
|
|
protected $claimModel;
|
|
|
|
public function __construct()
|
|
{
|
|
// Models
|
|
$this->empModel = new EmployeeModel();
|
|
$this->empPolicyModel = new EmployeePolicyModel();
|
|
$this->claimModel = new TicketMasterModel();
|
|
|
|
}
|
|
|
|
public function mapObjectType($data_to_map, $objectType)
|
|
{
|
|
$mapped_data = [];
|
|
foreach ($objectType as $key => $value){
|
|
$mapped_data[$key] = $data_to_map[$value];
|
|
}
|
|
|
|
return $mapped_data;
|
|
}
|
|
|
|
public function insertData($mapped_data, $type){
|
|
|
|
$model = $type == 1 ? "empModel" : "claimModel";
|
|
$this->$model->insert($mapped_data);
|
|
}
|
|
}
|