📜  基于 morphToMany 的过滤器 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:06.651000             🧑  作者: Mango

代码示例1
public function polyTypeOne()
{
    return $this->poly()->where('type','=','1');
}

// usage
$wollies = Woly::with('polyTypeOne')->get();

// pretty much the same as:
$wollies = Woly::with(['poly' => function ($q) {
  $q->where('type', 1);
}])->get();