hotfix: auditSkipUpdateOnlyFields 프로퍼티→메서드로 변경(로그인 500 수정)
trait와 MemberModel이 같은 프로퍼티를 다른 기본값으로 선언해 PHP 비호환 fatal → 로그인(member update) 시 500. 메서드 override 방식으로 변경해 해결. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,10 @@ class MemberModel extends Model
|
|||||||
use \App\Models\Traits\Auditable;
|
use \App\Models\Traits\Auditable;
|
||||||
|
|
||||||
/** 로그인/세션 갱신만 있는 update는 활동 로그에 남기지 않음(로그인 이력은 별도 기록) */
|
/** 로그인/세션 갱신만 있는 update는 활동 로그에 남기지 않음(로그인 이력은 별도 기록) */
|
||||||
protected array $auditSkipUpdateOnlyFields = ['mb_latestdate', 'mb_login_fail_count', 'mb_locked_until', 'mb_session_token'];
|
protected function auditSkipUpdateOnlyFields(): array
|
||||||
|
{
|
||||||
|
return ['mb_latestdate', 'mb_login_fail_count', 'mb_locked_until', 'mb_session_token'];
|
||||||
|
}
|
||||||
|
|
||||||
protected $table = 'member';
|
protected $table = 'member';
|
||||||
protected $primaryKey = 'mb_idx';
|
protected $primaryKey = 'mb_idx';
|
||||||
|
|||||||
@@ -41,9 +41,14 @@ trait Auditable
|
|||||||
/**
|
/**
|
||||||
* 이 필드들'만' 변경된 update는 활동 로그를 남기지 않는다.
|
* 이 필드들'만' 변경된 update는 활동 로그를 남기지 않는다.
|
||||||
* (예: 로그인/세션 갱신 같은 시스템 내부 변경 — 노이즈 제거)
|
* (예: 로그인/세션 갱신 같은 시스템 내부 변경 — 노이즈 제거)
|
||||||
* 모델에서 재정의해 사용.
|
* 모델에서 이 메서드를 override 해 사용. (프로퍼티로 두면 trait/class 비호환 오류)
|
||||||
|
*
|
||||||
|
* @return list<string>
|
||||||
*/
|
*/
|
||||||
protected array $auditSkipUpdateOnlyFields = [];
|
protected function auditSkipUpdateOnlyFields(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
private function auditMask(?array $row): ?array
|
private function auditMask(?array $row): ?array
|
||||||
{
|
{
|
||||||
@@ -106,9 +111,10 @@ trait Auditable
|
|||||||
$changes = is_array($eventData['data'] ?? null) ? $eventData['data'] : [];
|
$changes = is_array($eventData['data'] ?? null) ? $eventData['data'] : [];
|
||||||
|
|
||||||
// 지정 필드만 변경된 경우(로그인/세션 갱신 등) → 기록 생략
|
// 지정 필드만 변경된 경우(로그인/세션 갱신 등) → 기록 생략
|
||||||
if ($this->auditSkipUpdateOnlyFields !== [] && $changes !== []) {
|
$skipOnly = $this->auditSkipUpdateOnlyFields();
|
||||||
|
if ($skipOnly !== [] && $changes !== []) {
|
||||||
$changedKeys = array_values(array_diff(array_keys($changes), [$this->primaryKey]));
|
$changedKeys = array_values(array_diff(array_keys($changes), [$this->primaryKey]));
|
||||||
if ($changedKeys !== [] && array_diff($changedKeys, $this->auditSkipUpdateOnlyFields) === []) {
|
if ($changedKeys !== [] && array_diff($changedKeys, $skipOnly) === []) {
|
||||||
$this->auditBeforeRows = [];
|
$this->auditBeforeRows = [];
|
||||||
|
|
||||||
return $eventData;
|
return $eventData;
|
||||||
|
|||||||
Reference in New Issue
Block a user