Skip to content

Commit

Permalink
get_device_id_by_port_id(x) => Port::find(x)->device_id
Browse files Browse the repository at this point in the history
  • Loading branch information
mpikzink committed Jan 7, 2025
1 parent f71052c commit cac1ca1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/html/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use App\Facades\DeviceCache;
use App\Models\Device;
use App\Models\Port;
use LibreNMS\Config;
use LibreNMS\Enum\ImageFormat;
use LibreNMS\Util\Number;
Expand Down Expand Up @@ -91,7 +92,7 @@ function bill_permitted($bill_id)
function port_permitted($port_id, $device_id = null)
{
if (! is_numeric($device_id)) {
$device_id = Device::whereHas('ports', fn ($p) => $p->port_id = $port_id)->device_id;
$device_id = Port::find($port_id)->device_id;
}

if (device_permitted($device_id)) {
Expand Down

0 comments on commit cac1ca1

Please sign in to comment.