public function updateFromFirmwareForm($form) { $this->description = $form['description']; if ($form['device_type']) { $device_type = DeviceType::findOrCreateByName($form['device_type']); $this->device_type_id = $device_type->id; } if ($form['manufacturer']) { $manufacturer = Manufacturer::findOrCreateByName($form['manufacturer']); $this->manufacturer_id = $manufacturer->id; } if ($form['odm']) { $odm = Manufacturer::findOrCreateByName($form['odm']); $this->odm_id = $odm->id; } if ($form['model_number']) { $model_number = ModelNumber::findOrCreateByValueAndManufacturer($form['model_number'], $this->manufacturer_id); $this->model_number_id = $model_number->id; } if ($form['chipset']) { $chipset = Chipset::findOrCreateByValue($form['chipset']); $this->chipset_id = $chipset->id; } $this->fcc_number = $form['fcc_number']; $this->download_url = $form['download_url']; $this->mac_address = $form['mac_address']; $this->notes = $form['notes']; }