Many to Many 관계에서 모든 item_id를 가져 오는 함수가 있습니까? Many Many Many Id Function Laravel 5.2
$subcategory = $this->subcategory->find($id);
또는 내가 수동으로 할 필요가 있는가. 기본적으로 할 수 있지만 집계 함수가 있기를 바랍니다.
$itemIds=[];
foreach($subcategory->items as $item){
$itemIds[] = $item->id;
}
답변을 요청하기 전에 연구하려고하는 것은 여기에 있습니다 : http://stackoverflow.com/questions/36593847/laravel-eloquent-get-all-records-wherehas-all-ids-in-many -to-many-relation – d3r1ck