据我所知,选择查询是
$bearLawly = Bear::where('name', '=', 'Lawly')->first();
但如何进行选择查询,例如
SELECT * FROM bear where name = 'abc' AND age => '5' AND title = 'kid' ORDER BY name LIMIT 5, 10
谢谢!
答案 0 :(得分:1)
你可以试试这个:
$bearLawly = Bear::where('name', 'abc') // By default = will be used, so optional
->where('age', '>=', '5')
->where('title', 'kid')
->orderBy('name') // or orderBy('name', 'desc') for reverse
->take(5)->skip(10)->get();
根据以下查询:
SELECT * FROM bear where name = 'abc' AND age => '5' AND title = 'kid' ORDER BY name LIMIT 5, 10
答案 1 :(得分:0)
将它们链起来:
$bearLawly = Bear::where('name', 'Lawly')->where('age', '5')->first();