Laravel 4 Eloquent ORM 选择 where - array 作为参数 [英] Laravel 4 Eloquent ORM select where - array as parameter
本文介绍了Laravel 4 Eloquent ORM 选择 where - array 作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Eloquent ORM 中有解决方案吗?
Is solution for this in Eloquent ORM?
我有一个带有父母标识符的数组:
I have array with parents idetifiers:
Array ( [0] => 87, [1] => 65, ... )
我想选择表 PRODUCTS,其中 parent_id 列 = 数组中的任何 id
And i want select table PRODUCTS where parent_id column = any id in array
推荐答案
Fluent:
DB::table('PRODUCTS')->whereIn('parent_id', $parent_ids)->get();
雄辩:
Product::whereIn('parent_id', $parent_ids)->get();
这篇关于Laravel 4 Eloquent ORM 选择 where - array 作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文