From ee67b0c0c053d23019605d4cf7f0fd12c9c927cf Mon Sep 17 00:00:00 2001 From: liapples Date: Thu, 12 Aug 2021 17:06:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0passMd5=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/BaseModel.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index e55ea3f..200cf17 100644 --- a/app/Models/BaseModel.php +++ b/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); } }