关联查询中 `whereHas` 中的 where 变量如何传入?
public static function findservice($code){
$filterins = Service::whereHas('mount', function($q)
{
$q->where('customer_id', $code);
})->get();
}
public static function findservice($code){
$filterins = Service::whereHas('mount', function($q,$code)
{
$q->where('customer_id', $code);
})->get();
}
请教一下 $code 如何才能传入,上面两种写法都无法将 $code 传入
推荐文章: