Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Up/Down time in Device List #9951

Merged
merged 12 commits into from Mar 18, 2019

last polled in casts

  • Loading branch information...
PipoCanaja committed Mar 15, 2019
commit c7b70458cb993ef065cccb715a598449bc282430
@@ -126,7 +126,7 @@ public function formatItem($device)
'metrics' => $this->getMetrics($device),
'hardware' => Rewrite::ciscoHardware($device),
'os' => $this->getOsText($device),
'uptime' => Time::formatInterval($device->getStatus() ? $device->uptime : time() - $device->getLastPolled(), 'short'),
'uptime' => Time::formatInterval($device->getStatus() ? $device->uptime : $device->last_polled->diffInSeconds(), 'short'),
'location' => $this->getLocation($device),
'actions' => $this->getActions($device),
];
@@ -21,7 +21,10 @@ class Device extends BaseModel
public $timestamps = false;
protected $primaryKey = 'device_id';
protected $fillable = ['hostname', 'ip', 'status', 'status_reason'];
protected $casts = ['status' => 'boolean'];
protected $casts = [
'last_polled' => 'datetime',
'status' => 'boolean',
];
/**
* Initialize this class
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.