1
mit Ich möchte die folgende SQL-Anweisung in ein Eloquent Format neu zu schreiben:Equivalent für WHERE-Klausel Eloquent Funktion
SELECT `id`, `pushbadge`, `pushalert`, `pushsound`
FROM `devices`
WHERE `id` IN (1, 2, 3)
AND `status`='active'"
Mein Gedanke war
public function getDevicesWithIDs($ids) {
$conditions = array();
foreach($ids as $id) {
$conditions[] = ['id' => $id];
}
var_dump($conditions);
return Device::where($conditions)->get();
}
Aber dies zurück:
SQLSTATE[42S22]: Column not found: 1054
Unknown column '0' in 'where clause'
(SQL: select * from `devices` where (`0` = 1))
ausgezeichnet erhalten! Vielen Dank! – sesc360