Php Laravel 5何处有链环?何处有链环

Php Laravel 5何处有链环?何处有链环,php,mysql,laravel,eloquent,laravel-5,Php,Mysql,Laravel,Eloquent,Laravel 5,尝试查询具有较低级别关系(协议)的模型时,链接无法正常工作。我尝试了以下三种方法(第二种方法让我99%的时间都在那里,但它错过了其中一个结果-非活动设备“状态”和“非活动”协议(本应省略)。我做错了什么 每件设备都需要“有效”并有有效的现有协议(有效协议是指“有效”、“到期时取消”或“未签署”) 我不太明白为什么where equipment.status会被一遍又一遍地过滤相同的内容,如果我理解错误,下面的代码可能就是您要查找的结果 $thing = Equipment::whereHas('

尝试查询具有较低级别关系(协议)的模型时,链接无法正常工作。我尝试了以下三种方法(第二种方法让我99%的时间都在那里,但它错过了其中一个结果-非活动设备“状态”和“非活动”协议(本应省略)。我做错了什么

每件设备都需要“有效”并有有效的现有协议(有效协议是指“有效”、“到期时取消”或“未签署”)


我不太明白为什么where equipment.status会被一遍又一遍地过滤相同的内容,如果我理解错误,下面的代码可能就是您要查找的结果

$thing = Equipment::whereHas('agreement', function($q)use($month)
{
    $q->where('maintenance_months', 'like', '%'.$month.'%')
      ->whereIn('status',['Unsigned','Active','Cancel on Expiry'])
})->where('status','Active')->get();

我不太明白为什么where equipment.status会被一遍又一遍地过滤相同的内容,如果我理解错误,下面的代码可能就是您要查找的结果

$thing = Equipment::whereHas('agreement', function($q)use($month)
{
    $q->where('maintenance_months', 'like', '%'.$month.'%')
      ->whereIn('status',['Unsigned','Active','Cancel on Expiry'])
})->where('status','Active')->get();

我不太明白为什么where equipment.status会被一遍又一遍地过滤相同的内容,如果我理解错误,下面的代码可能就是您要查找的结果

$thing = Equipment::whereHas('agreement', function($q)use($month)
{
    $q->where('maintenance_months', 'like', '%'.$month.'%')
      ->whereIn('status',['Unsigned','Active','Cancel on Expiry'])
})->where('status','Active')->get();

我不太明白为什么where equipment.status会被一遍又一遍地过滤相同的内容,如果我理解错误,下面的代码可能就是您要查找的结果

$thing = Equipment::whereHas('agreement', function($q)use($month)
{
    $q->where('maintenance_months', 'like', '%'.$month.'%')
      ->whereIn('status',['Unsigned','Active','Cancel on Expiry'])
})->where('status','Active')->get();