修复:UserPurchase 模型补充 item() 关联别名
婚姻系统 whereHas('item') / with('item') 需要此方法,
原模型只有 shopItem(),现在加 item() 作为别名指向同一外键。
This commit is contained in:
@@ -32,6 +32,14 @@ class UserPurchase extends Model
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买记录对应的商品(shopItem 别名,兼容婚姻系统调用)
|
||||
*/
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ShopItem::class, 'shop_item_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买记录对应的商品
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user