diff --git a/app/Models/Device.php b/app/Models/Device.php index 38c3ac6..beda368 100644 --- a/app/Models/Device.php +++ b/app/Models/Device.php @@ -60,11 +60,11 @@ class Device extends Model public function getUpdateFirmwareAttribute(): bool { - if ($this->proxy_cloud_response && $this->proxy_cloud_response['update_firmware']) { + if ($this->update_firmware_id) { return true; } - if ($this->update_firmware_id) { + if ($this->proxy_cloud_response && $this->proxy_cloud_response['update_firmware']) { return true; } @@ -73,10 +73,6 @@ class Device extends Model public function getFirmwareUrlAttribute(): ?string { - if ($this->proxy_cloud_response && $this->proxy_cloud_response['firmware_url']) { - return $this->proxy_cloud_response['firmware_url']; - } - if ($this->update_firmware_id) { $firmware = Firmware::find($this->update_firmware_id); if ($firmware) { @@ -88,6 +84,10 @@ class Device extends Model } } + if ($this->proxy_cloud_response && $this->proxy_cloud_response['firmware_url']) { + return $this->proxy_cloud_response['firmware_url']; + } + return null; }