mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
35 lines
682 B
PHP
35 lines
682 B
PHP
<?php
|
|
|
|
namespace app\data\model;
|
|
|
|
use think\admin\Model;
|
|
use think\model\relation\HasOne;
|
|
|
|
/**
|
|
* 商城订单详情模型
|
|
* Class ShopOrderItem
|
|
* @package app\data\model
|
|
*/
|
|
class ShopOrderItem extends Model
|
|
{
|
|
/**
|
|
* 关联商品数据
|
|
* @return \think\model\relation\HasOne
|
|
*/
|
|
public function goods(): HasOne
|
|
{
|
|
return $this->hasOne(ShopGoods::class, 'code', 'goods_code');
|
|
}
|
|
|
|
/**
|
|
* 绑定商品数据
|
|
* @return \think\model\relation\HasOne
|
|
*/
|
|
public function bindGoods(): HasOne
|
|
{
|
|
return $this->goods()->bind([
|
|
'goods_name' => 'name',
|
|
'goods_cover' => 'cover',
|
|
]);
|
|
}
|
|
} |