caipan_shop_admin/app/model/ShoppingCart.php

42 lines
838 B
PHP
Executable File

<?php
namespace app\model;
use app\model\mall\SpuLimitTime;
use think\model\relation\HasMany;
use think\model\relation\HasOne;
/**
* 购物车
*
* Class ShoppingCart
* @package app\model
*/
class ShoppingCart extends Base
{
public function spu(): HasOne
{
return $this->hasOne(Spu::class, 'id', 'spu_id');
}
public function limitTime(): HasOne
{
return $this->hasOne(SpuLimitTime::class, 'id', 'spu_activity_id');
}
public function sku(): HasOne
{
return $this->hasOne(Sku::class, 'id', 'sku_id');
}
// public function skus(): HasMany
// {
// return $this->hasMany(Sku::class, 'spu_id', 'spu_id');
// }
// public function activitySkus(): HasMany
// {
// return $this->hasMany(Sku::class, 'spu_activity_id', 'spu_activity_id');
// }
}