diff --git a/app/Models/User.php b/app/Models/User.php index 3eda1ab..cbdadd7 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -90,6 +90,15 @@ class User extends Authenticatable implements Auditable return $this->username; } + public function getMobileAttribute($value) + { + // 如果url中包含admin字符串,则所有的手机号显示中间4位星号代替 + if (strpos(request()->url(), 'admin') !== false && env('APP_ENV') == 'local') { + return substr_replace($value, '****', 3, 4); + } + return $value; + } + public function getAppointmentTotalAttribute($value) { $now = date('Y-m-d H:i:s');