1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class Report extends Model
- {
-
-
- // 表名
- protected $name = 'report';
-
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'integer';
- // 定义时间戳字段名
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected $deleteTime = false;
- // 追加属性
- protected $append = [
- 'report_status_text'
- ];
-
- public function getReportStatusList()
- {
- return ['0' =>__('Report_status 0'), '1' =>__('Report_status 1')];
- }
- public function getReportStatusTextAttr($value, $data)
- {
- $value = $value ? $value : (isset($data['report_status']) ? $data['report_status'] : '');
- $list = $this->getReportStatusList();
- return isset($list[$value]) ? $list[$value] : '';
- }
- public function user()
- {
- return $this->belongsTo('User', 'user_id', 'id',[],'LEFT')->setEagerlyType(0);
- }
- }
|