attributes['userid'])->first(); } public function getDisplayCodeAttribute() { $value = (string) ($this->attributes['code'] ?? ''); $type = (int) ($this->attributes['type'] ?? 0); if (in_array($type, [10005, 10007], true) && preg_match('/^[A-Za-z0-9]{8}$/', $value) !== 1) { return strtoupper(substr(hash('sha256', 'recharge-display:' . $value), 0, 8)); } return $value; } }