[英]laravel: multiple select query
I understand that to do a select query is 我了解执行选择查询是
$bearLawly = Bear::where('name', '=', 'Lawly')->first();
but how to I do a select query such as 但是我该如何选择查询
SELECT * FROM bear where name = 'abc' AND age => '5' AND title = 'kid' ORDER BY name LIMIT 5, 10
Thanks! 谢谢!
You may try this: 您可以尝试以下方法:
$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();
According to following query: 根据以下查询:
SELECT * FROM bear where name = 'abc' AND age => '5' AND title = 'kid' ORDER BY name LIMIT 5, 10
只需将它们链接:
$bearLawly = Bear::where('name', 'Lawly')->where('age', '5')->first();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.