I have this function to create a device from an API.
for($i=0;$i < count($response); $i++)
{
$device = Device::create([
'device_id' => $response['devices'][$i]['device_id'],
'source_id' => Device::getSource($options['deviceSourceId'])->id,
'alias' => $response['devices'][$i]['alias'],
'online_state' => $response['devices'][$i]['online_state'],
]);
}
And this is the raw JSON data.
It needs to get the data from every device from the JSON response and create a device. Can anybody help me out?