37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class NonEbClaimAssetModel extends Model
|
|
{
|
|
protected $table = 'non_eb_claim_assets';
|
|
protected $primaryKey = 'id';
|
|
protected $useAutoIncrement = true;
|
|
protected $returnType = 'array';
|
|
protected $useSoftDeletes = false;
|
|
protected $protectFields = true;
|
|
protected $allowedFields = [
|
|
'id', 'non_eb_ticket_id', 'asset_id_code', 'serial_no',
|
|
'vehicle_no', 'asset_description',
|
|
'is_active', 'created_by', 'updated_by', 'created_at', 'updated_at'
|
|
];
|
|
|
|
protected $allowCallbacks = true;
|
|
protected $beforeInsert = ['checkAndADDCreatedByValue'];
|
|
protected $beforeUpdate = ['checkAndUpdateUpdatedByValue'];
|
|
|
|
protected function checkAndADDCreatedByValue(array $data)
|
|
{
|
|
$data['data']['created_by'] = get_session_userid();
|
|
return $data;
|
|
}
|
|
|
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
|
{
|
|
$data['data']['updated_by'] = get_session_userid();
|
|
return $data;
|
|
}
|
|
}
|