Browse Source

去掉密码修改器,因为后台已经存在相关方法

dev
李可松 4 years ago
parent
commit
764e24d3b8
  1. 12
      app/Models/Agent.php
  2. 6
      app/Models/BaseModel.php
  3. 12
      app/Models/Guide.php
  4. 12
      app/Models/Supplier.php

12
app/Models/Agent.php

@ -31,18 +31,6 @@ class Agent extends BaseModel
$this->attributes['license_pic'] = str_replace(env('APP_URL'), '', $value); $this->attributes['license_pic'] = str_replace(env('APP_URL'), '', $value);
} }
public function setPasswordAttribute($value)
{
if ($value) {
if (
empty($this->attributes['password']) || //新增时
$this->attributes['password'] != $value && !empty($this->attributes['password']) //编辑时
) {
$this->attributes['password'] = $this->passMd5($value);
}
}
}
public function agentInfo() public function agentInfo()
{ {
return $this->hasOne(AgentInfo::class); return $this->hasOne(AgentInfo::class);

6
app/Models/BaseModel.php

@ -24,10 +24,4 @@ class BaseModel extends Model
$builder->orderBy((new static())->getTable().'.id', 'desc'); $builder->orderBy((new static())->getTable().'.id', 'desc');
}); });
} }
//供应商、代理商、地接、后台管理员等密码加密
protected function passMd5($value): string
{
return md5('9e97ae0d950a4b10182c99d484b204c8' . $value);
}
} }

12
app/Models/Guide.php

@ -8,16 +8,4 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class Guide extends BaseModel class Guide extends BaseModel
{ {
use HasFactory, SoftDeletes; use HasFactory, SoftDeletes;
public function setPasswordAttribute($value)
{
if ($value) {
if (
empty($this->attributes['password']) || //新增时
$this->attributes['password'] != $value && !empty($this->attributes['password']) //编辑时
) {
$this->attributes['password'] = $this->passMd5($value);
}
}
}
} }

12
app/Models/Supplier.php

@ -18,16 +18,4 @@ class Supplier extends BaseModel
{ {
return $value ? $this->host . $value : ''; return $value ? $this->host . $value : '';
} }
public function setPasswordAttribute($value)
{
if ($value) {
if (
empty($this->attributes['password']) || //新增时
$this->attributes['password'] != $value && !empty($this->attributes['password']) //编辑时
) {
$this->attributes['password'] = $this->passMd5($value);
}
}
}
} }
Loading…
Cancel
Save