WorkWelcome.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\work;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * Class WorkWelcome
  16. * @package app\model\work
  17. */
  18. class WorkWelcome extends BaseModel
  19. {
  20. use ModelTrait;
  21. /**
  22. * @var string
  23. */
  24. protected $name = 'work_welcome';
  25. /**
  26. * @var string
  27. */
  28. protected $key = 'id';
  29. /**
  30. * @var string
  31. */
  32. protected $autoWriteTimestamp = 'int';
  33. /**
  34. * 成员
  35. * @return \think\model\relation\HasMany
  36. */
  37. public function userList()
  38. {
  39. return $this->hasMany(WorkWelcomeRelation::class, 'welcome_id', 'id');
  40. }
  41. /**
  42. * @param $value
  43. * @return false|string
  44. */
  45. public function setAttachmentsAttr($value)
  46. {
  47. return json_encode($value);
  48. }
  49. /**
  50. * @param $value
  51. * @return mixed
  52. */
  53. public function getAttachmentsAttr($value)
  54. {
  55. return json_decode($value, true);
  56. }
  57. }