mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat: proxy firmware update & url through to device
This commit is contained in:
parent
f74d36e40d
commit
3906747b1a
2 changed files with 19 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ class Device extends Model
|
|||
protected $casts = [
|
||||
'proxy_cloud' => 'boolean',
|
||||
'last_log_request' => 'json',
|
||||
'proxy_cloud_response' => 'json',
|
||||
];
|
||||
|
||||
public function getBatteryPercentAttribute()
|
||||
|
|
@ -52,6 +53,22 @@ class Device extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getUpdateFirmwareAttribute() : bool
|
||||
{
|
||||
if ($this->proxy_cloud_response && $this->proxy_cloud_response['update_firmware']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFirmwareUrlAttribute() : string | null
|
||||
{
|
||||
if ($this->proxy_cloud_response && $this->proxy_cloud_response['firmware_url']) {
|
||||
return $this->proxy_cloud_response['firmware_url'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function playlists(): HasMany
|
||||
{
|
||||
return $this->hasMany(Playlist::class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue