123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class Card extends Model
- {
- public $table = 'card';
- public $primaryKey = 'card_id';
- public $keyType = 'string';
- protected $dateFormat = 'U';
- const CREATED_AT = 'card_addtimes';
- const UPDATED_AT = null;
- public function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- /**
- * @Desc 关联会员主表
- * @Author Gorden
- * @Date 2024/11/15 14:39
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'join_card_member_id');
- }
- /**
- * @Desc 关联会员详情表
- * @Author Gorden
- * @Date 2024/11/15 15:57
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function info()
- {
- return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_card_member_id')
- ->select('join_info_member_id', 'member_info_nickname', 'member_info_headimg');
- }
- /**
- * @Desc 关联会员认证表
- * @Author Gorden
- * @Date 2024/11/15 14:39
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function cert()
- {
- return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_card_member_id')
- ->select('join_cert_member_id', 'member_cert_name');
- }
- /**
- * @Desc 关联部门
- * @Author Gorden
- * @Date 2024/11/15 14:43
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function dept()
- {
- return $this->hasOne(SysDept::class, 'dept_id', 'join_card_dept_id')->select('dept_id', 'dept_name');
- }
- /**
- * @Desc 关联后台用户
- * @Author Gorden
- * @Date 2024/11/15 14:44
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(SysUser::class, 'user_id', 'join_card_user_id')->select('user_id', 'user_name');
- }
- /**
- * @Desc 关联卡主表
- * @Author Gorden
- * @Date 2024/11/15 14:55
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function main()
- {
- return $this->hasOne(CardMain::class, 'card_main_id', 'join_card_main_id');
- }
- /**
- * @Desc 关联发行表
- * @Author Gorden
- * @Date 2024/11/15 14:56
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function issue()
- {
- return $this->hasOne(CardIssue::class, 'card_issue_id', 'join_card_issue_id');
- }
- }
|