'required|integer', 'policy_id' => 'required|integer', 'policy_no' => 'required|max_length[100]', 'commission_amount' => 'decimal' ]; protected $validationMessages = []; protected $skipValidation = false; protected $beforeInsert = ["checkAndAddCreatedByValue"]; protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"]; protected function checkAndAddCreatedByValue(array $data) { // Check if 'updated_by' value is null or empty if (empty($data['data']['created_by'])) { // Set 'updated_by' value to the current session user ID $data['data']['created_by'] = get_session_userid(); } return $data; } protected function checkAndUpdateUpdatedByValue(array $data) { // Check if 'updated_by' value is null or empty if (empty($data['data']['updated_by'])) { // Set 'updated_by' value to the current session user ID $data['data']['updated_by'] = get_session_userid(); } return $data; } }