我正在使用此查询。
Safety::with( ['imageName'] )->where( ['property_id', '=', $property->property_id ], ['unit_id', '=', $property->unit_id ],['type','=', 'gas' ])->latest()->first();
我收到错误
SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause'
。
查询有问题吗?
问题出在您的
where
条款中。将其合并到一个数组并尝试
Safety::with(['imageName'])
->where([
['property_id', '=', $property->property_id],
['unit_id', '=', $property->unit_id],
['type', '=', 'gas']
])
->latest()
->first();