1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?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');
- }
- public function memberInfo()
- {
- return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_appointment_member_id')
- ->select('join_info_member_id', 'member_info_nickname');
- }
- public function cert()
- {
- return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_appointment_member_id')
- ->select('join_cert_member_id', 'member_cert_name');
- }
- /**
- * @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');
- }
- public function running()
- {
- return $this->hasOne(GoodsRunning::class, 'join_running_goods_id', 'join_appointment_goods_id')
- ->select('join_running_goods_id', 'goods_running_storage', 'goods_running_sale');
- }
- /**
- * @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');
- }
- public function sku(){
- return $this->hasMany(GoodsSku::class,'join_sku_goods_id','join_appointment_goods_id')
- ->select('goods_sku_id','goods_sku_specs_json','goods_sku_sales_price');
- }
- }
|