Files
jongryangje/app/Models/MemberModel.php
taekyoungc 05d9d8aff3 hotfix: auditSkipUpdateOnlyFields 프로퍼티→메서드로 변경(로그인 500 수정)
trait와 MemberModel이 같은 프로퍼티를 다른 기본값으로 선언해 PHP 비호환 fatal →
로그인(member update) 시 500. 메서드 override 방식으로 변경해 해결.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 20:06:07 +09:00

58 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class MemberModel extends Model
{
use \App\Models\Traits\Auditable;
/** 로그인/세션 갱신만 있는 update는 활동 로그에 남기지 않음(로그인 이력은 별도 기록) */
protected function auditSkipUpdateOnlyFields(): array
{
return ['mb_latestdate', 'mb_login_fail_count', 'mb_locked_until', 'mb_session_token'];
}
protected $table = 'member';
protected $primaryKey = 'mb_idx';
protected $returnType = 'object';
protected $useTimestamps = false;
protected $allowedFields = [
'mb_id',
'mb_passwd',
'mb_totp_secret',
'mb_totp_enabled',
'mb_name',
'mb_email',
'mb_phone',
'mb_lang',
'mb_level',
'mb_group',
'mb_lg_idx',
'mb_state',
'mb_regdate',
'mb_latestdate',
'mb_leavedate',
'mb_login_fail_count',
'mb_locked_until',
'mb_session_token',
];
/**
* mb_id로 회원 조회
*/
public function findByLoginId(string $mbId): ?object
{
return $this->where('mb_id', $mbId)->first();
}
/**
* mb_id 중복 여부
*/
public function isIdExists(string $mbId): bool
{
return $this->where('mb_id', $mbId)->countAllResults() > 0;
}
}