123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
-
-
- namespace app\model\work;
-
-
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- use think\model\relation\HasMany;
- use think\model\relation\HasOne;
-
- /**
- * 企业微信客户跟踪
- * Class WorkClientFollow
- * @package app\model\work
- */
- class WorkClientFollow extends BaseModel
- {
- use ModelTrait;
-
- /**
- * @var string
- */
- protected $name = 'work_client_follow';
-
- /**
- * @var string
- */
- protected $key = 'id';
-
- /**
- * @var string
- */
- protected $autoWriteTimestamp = 'int';
-
- /**
- * @return HasOne
- */
- public function client()
- {
- return $this->hasOne(WorkClient::class, 'id', 'client_id');
- }
-
- /**
- * @return HasMany
- */
- public function tags()
- {
- return $this->hasMany(WorkClientFollowTags::class, 'follow_id', 'id');
- }
-
- /**
- * @return HasOne
- */
- public function member()
- {
- return $this->hasOne(WorkMember::class, 'userid', 'userid');
- }
-
- /**
- * @param $query
- * @param $value
- */
- public function searchClientIdAttr($query, $value)
- {
- if (is_array($value)) {
- $query->whereIn('client_id', $value);
- } else {
- $query->where('client_id', $value);
- }
- }
- }
|