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.
kwpayroll/app/Models/EmploymentStatusModel.php

55 lines
1.6 KiB
PHTML

8 months ago
<?php
namespace App\Models;
use CodeIgniter\Model;
class EmploymentStatusModel extends Model
{
protected $table = 'emp_status';
protected $primaryKey = 'emp_status_id';
protected $useAutoIncrement = true;
protected $returnType = \App\Entities\EmploymentStatus::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['status_name'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = true;
8 months ago
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 = ['assignCreatedBy'];
8 months ago
protected $afterInsert = [];
protected $beforeUpdate = ['assignUpdatedBy'];
8 months ago
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function assignCreatedBy(array $data)
8 months ago
{
$data['data']['created_by'] = auth()->user()->employee_id;
return $data;
}
public function assignUpdatedBy(array $data)
8 months ago
{
$data['data']['updated_by'] = auth()->user()->employee_id;
return $data;
}
}