修复:headface accessor 自动转小写后缀
- getter 使用 strtolower() 兼容数据库中存量的 .GIF 大写记录 - setter 也自动转小写,确保新数据统一
This commit is contained in:
+3
-2
@@ -88,8 +88,9 @@ class User extends Authenticatable
|
|||||||
protected function headface(): Attribute
|
protected function headface(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: fn () => $this->usersf ?: '1.gif',
|
// 自动将后缀转小写,兼容数据库中的 .GIF 大写存量
|
||||||
set: fn (string $value) => ['usersf' => $value],
|
get: fn () => strtolower($this->usersf ?: '1.gif'),
|
||||||
|
set: fn (string $value) => ['usersf' => strtolower($value)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user