Where is information about "$device->" available?

I was looking at the following link

Someone added display text that instead of hostname the sysName was a valid choice in the availability widget.

After digging around in the librenms database I saw that sysName was was in the devices table. I figured that I should be able to show sysLocation as valid display text… instead, there is a column named location_id which is just pointing to a unique ID in the locations table which actually holds the sysLocation data. After digging deeper and a couple trials with error, I found that I needed to use the following.

What does $device->location->location mean?
Why is $device->sysLocation not returning any data?

Where can I find everything that is available with $device-> or how it is actually organized for pulling data from the DB?

It’s a eloquent relationship to the locations table.
https://laravel.com/docs/8.x/eloquent-relationships

1 Like

Thanks… This got me looking at eloquent and then the extend method.

So $device->location->location/lat/lng

/opt/librenms/app/Models/Device.php
/opt/librenms/app/Models/Location.php

And then finally I get location, lat, lng from the locations table.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.