4
나는 매우 쉽게 수행하여 브로커에 속하는 모든 ProductConfigurations 찾을 수 있습니다는 Laravel은 morphMany 수집에 조건을 지정
class Broker extends Eloquent{
public function configurable(){
return $this->morphTo();
}
}
class ProductConfiguration extends Eloquent{
public function productConfigurations()
{
return $this->morphMany('Excel\Products\ProductConfiguration','configurable');
}
}
다음 웅변 관계가 있습니다
$broker = Broker::find($id);
$productConfigurations = $broker->productConfigurations;
를 내가 그러나 ProductConfiguration에 대한 조건을 지정하는 방법이 명확하지 않으므로 내 ProductConfiguration에 type
필드가있는 경우
$broker = Broker::find($id);
$productConfigurations = $broker->productConfigurations->where('type' = 'reg');
문서 확인 나는 그것을하는 방법을 정확하게 찾을 수 없습니다.