WorkerShare.php 566 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class WorkerShare extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'cateid' => 'int',
  10. 'title' => 'string',
  11. 'tilpic' => 'string',
  12. 'status' => 'tinyint',
  13. 'priority' => 'int'
  14. ];
  15. public function getStatusTextAttr($value,$data)
  16. {
  17. $status = [1=>'显示',2=>'隐藏'];
  18. return $status[$data['status']];
  19. }
  20. // 关联WorkerShareCate
  21. public function workerShareCate()
  22. {
  23. return $this->hasOne(WorkerShareCate::class, "id", "cateid");
  24. }
  25. }