From 6e6006f525207a8f982b0f6a2f345ba1c4dd4d79 Mon Sep 17 00:00:00 2001 From: liapples Date: Wed, 18 Aug 2021 12:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=86=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Agent.php | 8 ++++++++ app/Models/Guide.php | 8 ++++++++ app/Models/Supplier.php | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/app/Models/Agent.php b/app/Models/Agent.php index 66ce137..c201860 100644 --- a/app/Models/Agent.php +++ b/app/Models/Agent.php @@ -35,4 +35,12 @@ class Agent extends BaseModel { return $this->hasOne(AgentInfo::class); } + + //密码修改 + public function setPasswordAttribute($value) + { + if (!empty($value)) { + $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT); + } + } } diff --git a/app/Models/Guide.php b/app/Models/Guide.php index 5c03b1a..0489b4d 100644 --- a/app/Models/Guide.php +++ b/app/Models/Guide.php @@ -8,4 +8,12 @@ use Illuminate\Database\Eloquent\SoftDeletes; class Guide extends BaseModel { use HasFactory, SoftDeletes; + + //密码修改 + public function setPasswordAttribute($value) + { + if (!empty($value)) { + $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT); + } + } } diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php index 9a5ae21..baea81e 100644 --- a/app/Models/Supplier.php +++ b/app/Models/Supplier.php @@ -18,4 +18,12 @@ class Supplier extends BaseModel { return $value ? $this->host . $value : ''; } + + //密码修改 + public function setPasswordAttribute($value) + { + if (!empty($value)) { + $this->attributes['password'] = password_hash($value, PASSWORD_BCRYPT); + } + } }