Php Laravel-QLSTATE[23000]:完整性约束冲突:1052列';价值';where子句中的where子句是不明确的

Php Laravel-QLSTATE[23000]:完整性约束冲突:1052列';价值';where子句中的where子句是不明确的,php,mysql,sql,laravel-4,Php,Mysql,Sql,Laravel 4,我有很多亲戚 user_id | measurement_id | value 搜索查询 ->whereHas('measurement', function($q) use ( $from, $to ) { foreach (array_combine($from, $to) as $f => $t) { if(!empty($f) && !empty($t))

我有很多亲戚

user_id | measurement_id | value 
搜索查询

->whereHas('measurement', function($q) use ( $from, $to )
        {
              foreach (array_combine($from, $to) as $f => $t) {
                    if(!empty($f) && !empty($t))
                    {
                      $q->whereRaw('( value between ? and  ?)', array($f, $t));

                    }
                }
        })
我得到以下错误

SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'value' in where clause is ambiguous (SQL: select count(*) as aggregate
厌倦了下面的查询

$q->whereRaw('( users_measurement.value between ? and  ?)', array($f, $t));
然后我得到了这个错误

Column not found: 1054 Unknown column 'users_measurement.value' in 'where clause'
谁能帮我一下吗

编辑更具体的查询

用户模型

在我的控制器中搜索查询

function __construct(User $user)
    {
        $this->user = $user;


    }



public function search()
    {
    $users = $this->user
             ->whereHas('measurement', function($q) use ( $from, $to )
            {
                  foreach (array_combine($from, $to) as $f => $t) 
                  {
                        if(!empty($f) && !empty($t))
                        {
                           $q->whereRaw('( users.measurement.value between ? and  ?)', array($f, $t));
                        }
                    }
            })
           ->where('approved', '=', 1)
           ->where('activated', '=', 1)
           ->paginate(15);
}

您能显示完整的查询吗?现在可以了,很抱歉耽搁了
function __construct(User $user)
    {
        $this->user = $user;


    }



public function search()
    {
    $users = $this->user
             ->whereHas('measurement', function($q) use ( $from, $to )
            {
                  foreach (array_combine($from, $to) as $f => $t) 
                  {
                        if(!empty($f) && !empty($t))
                        {
                           $q->whereRaw('( users.measurement.value between ? and  ?)', array($f, $t));
                        }
                    }
            })
           ->where('approved', '=', 1)
           ->where('activated', '=', 1)
           ->paginate(15);
}