123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class Appointment extends Model
- {
- protected $table = 'appointment';
- protected $primaryKey = 'appointment_id';
- protected $keyType = 'string';
- protected $dateFormat = 'U';
- const CREATED_AT = 'appointment_addtimes';
- const UPDATED_AT = null;
- protected function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- /**
- * @Desc 关联用户
- * @Author Gorden
- * @Date 2024/3/29 10:59
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'join_appointment_member_id');
- }
- /**
- * @Desc 关联商品
- * @Author Gorden
- * @Date 2024/3/29 10:58
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function goods()
- {
- return $this->hasOne(Goods::class, 'goods_id', 'join_appointment_goods_id');
- }
- /**
- * @Desc 关联订单
- * @Author Gorden
- * @Date 2024/3/29 10:58
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function order()
- {
- return $this->hasOne(Order::class, 'order_id', 'join_appointment_order_id');
- }
- /**
- * @Desc 关联权益
- * @Author Gorden
- * @Date 2024/3/29 10:58
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function benefit()
- {
- return $this->hasOne(MemberBenefit::class, 'member_benefit_id', 'join_appointment_member_benefit_id');
- }
- }
|