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