Browse Source

增加passMd5生成密码方法

dev
李可松 5 years ago
parent
commit
ee67b0c0c0
  1. 13
      app/Models/BaseModel.php

13
app/Models/BaseModel.php

@ -12,6 +12,13 @@ class BaseModel extends Model
protected $dateFormat = 'U';
protected $host = '';
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->host = env('APP_URL');
}
//默认按id desc排序
protected static function booted()
{
static::addGlobalScope('orderById', function (Builder $builder) {
@ -19,9 +26,9 @@ class BaseModel extends Model
});
}
public function __construct(array $attributes = [])
//供应商、代理商、地接、后台管理员等密码加密
protected function passMd5($value): string
{
parent::__construct($attributes);
$this->host = env('APP_URL');
return md5('9e97ae0d950a4b10182c99d484b204c8' . $value);
}
}
Loading…
Cancel
Save