1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Topicdongtai extends Model
- {
-
-
-
- protected $name = 'topic_dongtai';
-
-
- protected $autoWriteTimestamp = 'int';
-
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
-
- protected $append = [
- 'is_hidden_text'
- ];
-
-
- public function getIsHiddenList()
- {
- return ['1' => __('Is_hidden 1'), '0' => __('Is_hidden 0')];
- }
- public function getIsHiddenTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['is_hidden']) ? $data['is_hidden'] : '');
- $list = $this->getIsHiddenList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function topichub()
- {
- return $this->belongsTo('Topichub', 'topic_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- public function user()
- {
- return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
- }
- }
|