海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
502 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class Guide extends BaseModel
  6. {
  7. use HasFactory, SoftDeletes;
  8. public function setPasswordAttribute($value)
  9. {
  10. if ($value) {
  11. if (
  12. empty($this->attributes['password']) || //新增时
  13. $this->attributes['password'] != $value && !empty($this->attributes['password']) //编辑时
  14. ) {
  15. $this->attributes['password'] = $this->passMd5($value);
  16. }
  17. }
  18. }
  19. }