public function getLastNodeOnlineLog() { $id = $this->attributes['id']; $log = NodeOnlineLog::where('node_id', $id)->orderBy('id', 'desc')->first(); if ($log == null) { return null; } return $log; }