如何执行';和';laravel 4.1中的多参数操作


How to carry out the 'and' operation in laravel 4.1 with multiple parameters

我想知道如何在laravel中编写以下内容:

SELECT * FROM items WHERE item_id = $id AND item_category = $cat AND item_price = $price;

$id、$cat和$price被动态地传递给查询。谢谢

Eloquent

Item::where('item_id', $id)
->where('item_category', $cat)
->where('item_price', $price)
->get();

Fluent

DB::table('items')
->where('item_id', $id)
->where('item_category', $cat)
->where('item_price', $price)
->get();