You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.3 KiB
PHP
70 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class EmployeePayrollInfoModel extends Model
|
|
{
|
|
protected $table = 'emp_pay_info';
|
|
protected $primaryKey = 'emppay_id';
|
|
protected $useAutoIncrement = true;
|
|
protected $returnType = \App\Entities\EmployeePayrollInfo::class;
|
|
protected $useSoftDeletes = false;
|
|
protected $protectFields = true;
|
|
protected $allowedFields = ['employee_id',
|
|
'paytype_id',
|
|
'is_ATM',
|
|
'savings_account',
|
|
'basic_monthly_pay',
|
|
'basic_semi_monthly_pay',
|
|
'basic_daily_pay',
|
|
'basic_hourly_pay',
|
|
'has_cola',
|
|
'has_philhealth',
|
|
'has_hdmf',
|
|
'has_sss',
|
|
'has_gsis'];
|
|
|
|
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 = ['assignCreatedAt'];
|
|
protected $afterInsert = [];
|
|
protected $beforeUpdate = ['assignUpdatedAt'];
|
|
protected $afterUpdate = [];
|
|
protected $beforeFind = [];
|
|
protected $afterFind = [];
|
|
protected $beforeDelete = [];
|
|
protected $afterDelete = [];
|
|
|
|
|
|
public function assignCreatedAt(array $data)
|
|
{
|
|
$data['data']['created_at'] = date('Y-m-d H:i:s');
|
|
$data['data']['created_by'] = auth()->user()->employee_id;
|
|
return $data;
|
|
}
|
|
|
|
public function assignUpdatedAt(array $data)
|
|
{
|
|
$data['data']['updated_at'] = date('Y-m-d H:i:s');
|
|
$data['data']['updated_by'] = auth()->user()->employee_id;
|
|
return $data;
|
|
}
|
|
}
|