123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class Task extends Model
- {
- protected $table = 'task';
- protected $primaryKey = 'task_id';
- protected $dateFormat = 'U';
- const CREATED_AT = 'task_addtimes';
- const UPDATED_AT = null;
- protected function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- /**
- * @Desc 申请人
- * @Author Gorden
- * @Date 2024/4/7 15:24
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'join_task_apply_user_id');
- }
- /**
- * @Desc 受理人
- * @Author Gorden
- * @Date 2024/4/7 15:24
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(SysUser::class, 'user_id', 'join_task_assign_user_id');
- }
- /**
- * @Desc 关联订单
- * @Author Gorden
- * @Date 2024/4/7 16:02
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function order()
- {
- return $this->hasOne(Order::class, 'order_id', 'join_task_order_id');
- }
- public function memberInfo()
- {
- return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_task_apply_user_id')
- ->select('join_info_member_id', 'member_info_nickname');
- }
- public function cert()
- {
- return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_task_apply_user_id')
- ->select('join_cert_member_id', 'member_cert_name');
- }
- /**
- * @Desc 关联预约
- * @Author Gorden
- * @Date 2024/4/7 16:03
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function appointment()
- {
- return $this->hasOne(Appointment::class, 'appointment_id', 'join_task_appointment_id');
- }
- }
|