【发布时间】:2020-04-26 11:46:53
【问题描述】:
我在我的项目中使用Metable 为订单创建元
但我有一个问题
我想要具有相同电子邮件的团体订单
这是表图片:image 1image 2
我需要这样的代码才能工作:)
Order::whereHas( 'meta', function($query) {
$query->where("key" , "gmail");
})->groupBy('meta.value')->get();
这是在订单模型中由 trait 'use Metatable' 调用的元关系:
public function meta(): MorphMany
{
return $this->morphMany($this->getMetaClassName(), 'metable');
}
谢谢
【问题讨论】: