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); + } + } }