Мой запрос:
Код: Выделить всё
$correspondingLamps = Lamp::where(['fitting' => $fitting, 'dimmability' => $dimmable])
->where(function ($query) {
$query->where('light_color_code', '=', '2800K')
->orWhere('light_color_code', '=', '2700K');
})
->get();
Код: Выделить всё
foreach ($correspondingLamps as $lamp) {
$image = [
'lamp_id' => $lamp->image->lamp_id,
'path' => $lamp->image->path
];
array_push($images, $image);
}
return response()->json([
'images' => $images,
'lamps' => $correspondingLamps
]);
Подробнее здесь: https://stackoverflow.com/questions/593 ... o-response
Мобильная версия