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.
 
 
 
 
 
 

35 lines
742 B

  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class UserGroup extends Model
  5. {
  6. // 表名
  7. protected $name = 'user_group';
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = 'int';
  10. // 定义时间戳字段名
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. // 追加属性
  14. protected $append = [
  15. 'status_text'
  16. ];
  17. public function getStatusList()
  18. {
  19. return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
  20. }
  21. public function getStatusTextAttr($value, $data)
  22. {
  23. $value = $value ? $value : $data['status'];
  24. $list = $this->getStatusList();
  25. return isset($list[$value]) ? $list[$value] : '';
  26. }
  27. }