我想将以下SQL语句重写为Eloquent Format:
@OneToMany(mappedBy="fournisseur",fetch = FetchType.EAGER,cascade={ CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE} )
private List<Carburant_entree> carburant_entrees;
@OneToMany(mappedBy="user",fetch = FetchType.EAGER,cascade={ CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REMOVE} )
private List<Users> theusers;
我的想法是
SELECT `id`, `pushbadge`, `pushalert`, `pushsound`
FROM `devices`
WHERE `id` IN (1, 2, 3)
AND `status`='active'"
但是这会回来:
public function getDevicesWithIDs($ids) {
$conditions = array();
foreach($ids as $id) {
$conditions[] = ['id' => $id];
}
var_dump($conditions);
return Device::where($conditions)->get();
}
答案 0 :(得分:3)
如果getClassType().getDeclaredConstructors() is return java.lang.NullPointerException (returning, not throwing)
是数组
您可以使用以下内容获取结果
$ids