Use Collection instead of collect() (#14527)

* Use Collection instead of collect()

* wip
This commit is contained in:
Jellyfrog
2022-11-05 10:04:36 +01:00
committed by GitHub
parent e5e169358f
commit 009d69a48d
21 changed files with 60 additions and 46 deletions
+2 -1
View File
@@ -32,6 +32,7 @@ use App\Models\OspfInstance;
use App\Models\OspfNbr;
use App\Models\OspfPort;
use App\Observers\ModuleModelObserver;
use Illuminate\Support\Collection;
use LibreNMS\Interfaces\Module;
use LibreNMS\OS;
use LibreNMS\RRD\RrdDefinition;
@@ -69,7 +70,7 @@ class Ospf implements Module
->hideMib()->enumStrings()
->walk('OSPF-MIB::ospfGeneralGroup')->valuesByIndex();
$ospf_instances = collect();
$ospf_instances = new Collection();
foreach ($ospf_instances_poll as $ospf_instance_id => $ospf_entry) {
if (empty($ospf_entry['ospfRouterId'])) {
continue; // skip invalid data
+2 -2
View File
@@ -142,7 +142,7 @@ class PrinterSupplies implements Module
private function discoveryLevels($device): Collection
{
$levels = collect();
$levels = new Collection();
$oids = snmpwalk_cache_oid($device, 'prtMarkerSuppliesLevel', [], 'Printer-MIB');
if (! empty($oids)) {
@@ -212,7 +212,7 @@ class PrinterSupplies implements Module
private function discoveryPapers($device): Collection
{
echo 'Tray Paper Level: ';
$papers = collect();
$papers = new Collection();
$tray_oids = snmpwalk_cache_oid($device, 'prtInputName', [], 'Printer-MIB');
if (! empty($tray_oids)) {
+2 -1
View File
@@ -27,6 +27,7 @@ namespace LibreNMS\OS;
use App\Models\Device;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\MempoolsDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
@@ -80,7 +81,7 @@ class Comware extends OS implements MempoolsDiscovery, ProcessorDiscovery
public function discoverMempools()
{
$mempools = collect();
$mempools = new Collection();
$data = snmpwalk_group($this->getDeviceArray(), 'hh3cEntityExtMemUsage', 'HH3C-ENTITY-EXT-MIB');
if (empty($data)) {
+2 -1
View File
@@ -27,6 +27,7 @@ namespace LibreNMS\OS;
use App\Models\Device;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\MempoolsDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
@@ -69,7 +70,7 @@ class Dlinkap extends OS implements MempoolsDiscovery, ProcessorDiscovery
$memory = snmp_get($this->getDeviceArray(), $oid, '-OQv');
if ($memory === false) {
return collect();
return new Collection();
}
return collect()->push((new Mempool([
+3 -2
View File
@@ -27,6 +27,7 @@ namespace LibreNMS\OS;
use App\Models\Device;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use LibreNMS\Device\Processor;
use LibreNMS\Device\YamlDiscovery;
@@ -42,7 +43,7 @@ class Edgecos extends OS implements MempoolsDiscovery, ProcessorDiscovery
$data = snmp_get_multi_oid($this->getDeviceArray(), ['memoryTotal.0', 'memoryFreed.0', 'memoryAllocated.0'], '-OUQs', $mib);
if (empty($data)) {
return collect();
return new Collection();
}
$mempool = new Mempool([
@@ -62,7 +63,7 @@ class Edgecos extends OS implements MempoolsDiscovery, ProcessorDiscovery
$mempool->fillUsage($data['memoryAllocated.0'] ?? null, $data['memoryTotal.0'] ?? null, $data['memoryFreed.0']);
return collect([$mempool]);
return new \Illuminate\Support\Collection([$mempool]);
}
public function discoverOS(Device $device): void
+2 -1
View File
@@ -26,13 +26,14 @@
namespace LibreNMS\OS;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Interfaces\Discovery\MempoolsDiscovery;
class Enterasys extends \LibreNMS\OS implements MempoolsDiscovery
{
public function discoverMempools()
{
$mempools = collect();
$mempools = new Collection();
$mem = snmpwalk_group($this->getDeviceArray(), 'etsysResourceStorageTable', 'ENTERASYS-RESOURCE-UTILIZATION-MIB', 3);
foreach ($mem as $index => $mem_data) {
+2 -1
View File
@@ -28,6 +28,7 @@ namespace LibreNMS\OS;
use App\Models\Device;
use App\Models\Sla;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use LibreNMS\Interfaces\Discovery\SlaDiscovery;
use LibreNMS\Interfaces\Polling\OSPolling;
use LibreNMS\Interfaces\Polling\SlaPolling;
@@ -71,7 +72,7 @@ class Junos extends \LibreNMS\OS implements SlaDiscovery, OSPolling, SlaPolling
public function discoverSlas()
{
$slas = collect();
$slas = new Collection();
$sla_table = snmpwalk_cache_oid($this->getDeviceArray(), 'pingCtlTable', [], 'DISMAN-PING-MIB');
if (! empty($sla_table)) {
+2 -1
View File
@@ -26,6 +26,7 @@
namespace LibreNMS\OS;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Device\Processor;
use LibreNMS\Interfaces\Discovery\MempoolsDiscovery;
use LibreNMS\Interfaces\Discovery\ProcessorDiscovery;
@@ -61,7 +62,7 @@ class Scalance extends OS implements MempoolsDiscovery, ProcessorDiscovery
$mempool_data = snmp_get_multi_oid($this->getDeviceArray(), [$perc_oid, $warn_oid]);
if ($mempool_data[$perc_oid] === false) {
return collect();
return new Collection();
}
return collect()->push((new Mempool([
+3 -3
View File
@@ -133,7 +133,7 @@ class Cisco extends OS implements
return parent::discoverMempools(); // yaml
}
$mempools = collect();
$mempools = new Collection();
$cemp = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'cempMemPoolTable', [], 'CISCO-ENHANCED-MEMPOOL-MIB');
foreach (Arr::wrap($cemp) as $index => $entry) {
@@ -318,7 +318,7 @@ class Cisco extends OS implements
public function discoverSlas()
{
$slas = collect();
$slas = new Collection();
$sla_data = snmpwalk_cache_oid($this->getDeviceArray(), 'rttMonCtrl', [], 'CISCO-RTTMON-MIB');
@@ -372,7 +372,7 @@ class Cisco extends OS implements
public function pollNac()
{
$nac = collect();
$nac = new Collection();
$portAuthSessionEntry = snmpwalk_cache_oid($this->getDeviceArray(), 'cafSessionEntry', [], 'CISCO-AUTH-FRAMEWORK-MIB');
if (! empty($portAuthSessionEntry)) {
+16 -16
View File
@@ -130,7 +130,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsLspCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsLspLastChange', $mplsLspCache, 'TIMETRA-MPLS-MIB', 'nokia', '-OQUst');
}
$lsps = collect();
$lsps = new Collection();
foreach ($mplsLspCache as $key => $value) {
[$vrf_oid, $lsp_oid] = explode('.', $key);
@@ -173,7 +173,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsPathCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsLspPathLastChange', $mplsPathCache, 'TIMETRA-MPLS-MIB', 'nokia', '-OQUst');
}
$paths = collect();
$paths = new Collection();
foreach ($mplsPathCache as $key => $value) {
[$vrf_oid, $lsp_oid, $path_oid] = explode('.', $key);
$lsp_id = $lsps->where('lsp_oid', $lsp_oid)->firstWhere('vrf_oid', $vrf_oid)->lsp_id;
@@ -208,7 +208,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
{
$mplsSdpCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpInfoTable', [], 'TIMETRA-SDP-MIB', 'nokia', '-OQUst');
$sdps = collect();
$sdps = new Collection();
foreach ($mplsSdpCache as $value) {
if ((! empty($value['sdpFarEndInetAddress'])) && ($value['sdpFarEndInetAddressType'] == 'ipv4')) {
$ip = long2ip(hexdec(str_replace(' ', '', $value['sdpFarEndInetAddress'])));
@@ -245,7 +245,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsSvcCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'svcBaseInfoTable', [], 'TIMETRA-SERV-MIB', 'nokia', '-OQUst');
$mplsSvcCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'svcTlsInfoTable', $mplsSvcCache, 'TIMETRA-SERV-MIB', 'nokia', '-OQUst');
$svcs = collect();
$svcs = new Collection();
// Workaround, remove some defalt entries we do not want to see
$filter = '/^\w* Service for internal purposes only/';
@@ -291,7 +291,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsSapCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sapBaseInfoTable', [], 'TIMETRA-SAP-MIB', 'nokia', '-OQUst');
$mplsSapTrafficCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sapBaseStatsTable', [], 'TIMETRA-SAP-MIB', 'nokia', '-OQUst');
$saps = collect();
$saps = new Collection();
// Workaround, there are some oids not covered by actual MIB, try to filter them
// i.e. sapBaseInfoEntry.300.118208001.1342177283.10
@@ -339,7 +339,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsBindCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpBindTable', [], 'TIMETRA-SDP-MIB', 'nokia', '-OQUsbt');
$mplsBindCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpBindBaseStatsTable', $mplsBindCache, 'TIMETRA-SDP-MIB', 'nokia', '-OQUsb');
$binds = collect();
$binds = new Collection();
foreach ($mplsBindCache as $key => $value) {
[$svcId] = explode('.', $key);
$bind_id = str_replace(' ', '', $value['sdpBindId']);
@@ -388,7 +388,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$arhops = collect();
$arhops = new Collection();
foreach ($mplsTunnelArHopCache as $key => $value) {
[$mplsTunnelARHopListIndex, $mplsTunnelARHopIndex] = explode('.', $key);
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelARHopListIndex', $mplsTunnelARHopListIndex)->lsp_path_id;
@@ -435,7 +435,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsTunnelCHopCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsTunnelCHopTable', [], 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
$lsp_ids = $paths->pluck('lsp_path_id', 'mplsLspPathTunnelCHopListIndex');
$chops = collect();
$chops = new Collection();
foreach ($mplsTunnelCHopCache as $key => $value) {
[$mplsTunnelCHopListIndex, $mplsTunnelCHopIndex] = explode('.', $key);
$lsp_path_id = $lsp_ids->get($mplsTunnelCHopListIndex);
@@ -468,7 +468,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsLspCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsLspStatTable', $mplsLspCache, 'TIMETRA-MPLS-MIB', 'nokia');
}
$lsps = collect();
$lsps = new Collection();
foreach ($mplsLspCache as $key => $value) {
[$vrf_oid, $lsp_oid] = explode('.', $key);
@@ -521,7 +521,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsPathCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsLspPathStatTable', $mplsPathCache, 'TIMETRA-MPLS-MIB', 'nokia');
}
$paths = collect();
$paths = new Collection();
foreach ($mplsPathCache as $key => $value) {
[$vrf_oid, $lsp_oid, $path_oid] = explode('.', $key);
$lsp_id = $lsps->where('lsp_oid', $lsp_oid)->firstWhere('vrf_oid', $vrf_oid)->lsp_id;
@@ -559,7 +559,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
{
$mplsSdpCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpInfoTable', [], 'TIMETRA-SDP-MIB', 'nokia', '-OQUst');
$sdps = collect();
$sdps = new Collection();
foreach ($mplsSdpCache as $value) {
if ((! empty($value['sdpFarEndInetAddress'])) && ($value['sdpFarEndInetAddressType'] == 'ipv4')) {
$ip = long2ip(hexdec(str_replace(' ', '', $value['sdpFarEndInetAddress'])));
@@ -596,7 +596,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsSvcCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'svcBaseInfoTable', [], 'TIMETRA-SERV-MIB', 'nokia', '-OQUst');
$mplsSvcCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'svcTlsInfoTable', $mplsSvcCache, 'TIMETRA-SERV-MIB', 'nokia', '-OQUst');
$svcs = collect();
$svcs = new Collection();
// Workaround, remove some default entries we do not want to see
$filter = '/^\w* Service for internal purposes only/';
@@ -641,7 +641,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsSapCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sapBaseInfoTable', [], 'TIMETRA-SAP-MIB', 'nokia', '-OQUst');
$mplsSapTrafficCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sapBaseStatsTable', [], 'TIMETRA-SAP-MIB', 'nokia', '-OQUst');
$saps = collect();
$saps = new Collection();
// Workaround, there are some oids not covered by actual MIB, try to filter them
// i.e. sapBaseInfoEntry.300.118208001.1342177283.10
@@ -719,7 +719,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsBindCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpBindTable', [], 'TIMETRA-SDP-MIB', 'nokia', '-OQUsbt');
$mplsBindCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'sdpBindBaseStatsTable', $mplsBindCache, 'TIMETRA-SDP-MIB', 'nokia', '-OQUsb');
$binds = collect();
$binds = new Collection();
foreach ($mplsBindCache as $key => $value) {
[$svcId] = explode('.', $key);
$bind_id = str_replace(' ', '', $value['sdpBindId']);
@@ -768,7 +768,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$preemptionPending = 0b00001000;
$nodeId = 0b00000100;
$arhops = collect();
$arhops = new Collection();
foreach ($mplsTunnelArHopCache as $key => $value) {
[$mplsTunnelARHopListIndex, $mplsTunnelARHopIndex] = explode('.', $key);
$lsp_path_id = $paths->firstWhere('mplsLspPathTunnelARHopListIndex', $mplsTunnelARHopListIndex)->lsp_path_id;
@@ -815,7 +815,7 @@ class Timos extends OS implements MplsDiscovery, MplsPolling, WirelessPowerDisco
$mplsTunnelCHopCache = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'vRtrMplsTunnelCHopTable', [], 'TIMETRA-MPLS-MIB', 'nokia', '-OQUsb');
$path_ids = $paths->pluck('lsp_path_id', 'mplsLspPathTunnelCHopListIndex');
$chops = collect();
$chops = new Collection();
foreach ($mplsTunnelCHopCache as $key => $value) {
[$mplsTunnelCHopListIndex, $mplsTunnelCHopIndex] = explode('.', $key);
$lsp_path_id = $path_ids[$mplsTunnelCHopListIndex] ?? null;
+2 -1
View File
@@ -28,6 +28,7 @@ namespace LibreNMS\OS\Traits;
use App\Models\Mempool;
use Closure;
use Exception;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use LibreNMS\Device\Processor;
use Rrd;
@@ -146,7 +147,7 @@ trait HostResources
$hr_storage = $this->getCacheTable('hrStorageTable', 'HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES');
if (! is_array($hr_storage)) {
return collect();
return new Collection();
}
$ram_bytes = snmp_get($this->getDeviceArray(), 'hrMemorySize.0', '-OQUv', 'HOST-RESOURCES-MIB') * 1024
+2 -1
View File
@@ -26,6 +26,7 @@
namespace LibreNMS\OS\Traits;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Device\Processor;
trait UcdResources
@@ -54,7 +55,7 @@ trait UcdResources
public function discoverMempools()
{
$mempools = collect();
$mempools = new Collection();
$data = snmp_get_multi($this->getDeviceArray(), [
'memTotalSwap.0',
'memAvailSwap.0',
+2 -1
View File
@@ -26,6 +26,7 @@
namespace LibreNMS\OS\Traits;
use App\Models\Mempool;
use Illuminate\Support\Collection;
use LibreNMS\Device\YamlDiscovery;
trait YamlMempoolsDiscovery
@@ -42,7 +43,7 @@ trait YamlMempoolsDiscovery
public function discoverYamlMempools()
{
$mempools = collect();
$mempools = new Collection();
$mempools_yaml = $this->getDiscovery('mempools');
foreach ($mempools_yaml['pre-cache']['oids'] ?? [] as $oid) {
+4 -3
View File
@@ -31,6 +31,7 @@ use App\Models\PortsNac;
use App\Models\Sla;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use LibreNMS\Device\Processor;
use LibreNMS\Device\WirelessSensor;
@@ -59,7 +60,7 @@ class Vrp extends OS implements
{
public function discoverMempools()
{
$mempools = collect();
$mempools = new Collection();
$mempools_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'hwEntityMemUsage', [], 'HUAWEI-ENTITY-EXTENT-MIB', 'huawei');
$mempools_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'hwEntityMemSize', $mempools_array, 'HUAWEI-ENTITY-EXTENT-MIB', 'huawei');
$mempools_array = snmpwalk_cache_multi_oid($this->getDeviceArray(), 'hwEntityBomEnDesc', $mempools_array, 'HUAWEI-ENTITY-EXTENT-MIB', 'huawei');
@@ -336,7 +337,7 @@ class Vrp extends OS implements
*/
public function pollNac()
{
$nac = collect();
$nac = new Collection();
// We collect the first table
$portAuthSessionEntry = snmpwalk_cache_oid($this->getDeviceArray(), 'hwAccessInterface', [], 'HUAWEI-AAA-MIB');
@@ -483,7 +484,7 @@ class Vrp extends OS implements
public function discoverSlas()
{
$slas = collect();
$slas = new Collection();
// Get the index of the last finished test
// NQA-MIB::nqaScheduleLastFinishIndex
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Models\Device;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
@@ -34,7 +35,7 @@ class BashCompletionCommand extends Command
*/
public function handle()
{
$completions = collect();
$completions = new Collection();
$line = getenv('COMP_LINE');
$current = getenv('COMP_CURRENT');
$previous = getenv('COMP_PREVIOUS');
@@ -74,7 +75,7 @@ class BashCompletionCommand extends Command
if ($option = $this->optionExpectsValue($current, $previous, $command_def)) {
$completions = $this->completeOptionValue($option, $current);
} else {
$completions = collect();
$completions = new Collection();
if (! Str::startsWith($previous, '-')) {
$completions = $this->completeArguments($command_name, $current, end($words));
}
@@ -233,7 +234,7 @@ class BashCompletionCommand extends Command
});
}
return collect();
return new Collection();
}
/**
@@ -259,7 +260,7 @@ class BashCompletionCommand extends Command
case 'help':
return $this->completeCommand($current_word);
default:
return collect();
return new Collection();
}
}
}
@@ -55,7 +55,7 @@ trait CompletesConfigArgument
protected function suggestionsForSelect(DynamicConfigItem $config, ?string $value): array
{
$options = collect($config['options']);
$options = new \Illuminate\Support\Collection($config['options']);
$keyStartsWith = $options->filter(function ($description, $key) use ($value) {
return Str::startsWith($key, $value);
});
@@ -27,6 +27,7 @@ namespace App\Http\Controllers\Widgets;
use App\Models\Location;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\View\View;
use LibreNMS\Config;
@@ -58,7 +59,7 @@ class GlobeController extends WidgetController
public function getView(Request $request)
{
$data = $this->getSettings();
$locations = collect();
$locations = new Collection();
$eager_load = $data['markers'] == 'ports' ? ['devices.ports'] : ['devices'];
$query = Location::hasAccess($request->user())
@@ -71,7 +72,7 @@ class GlobeController extends WidgetController
foreach ($query->get() as $location) {
$count = 0;
$up = 0;
$down_items = collect();
$down_items = new Collection();
if ($data['markers'] == 'devices') {
$count = $location->devices->count();
+2 -1
View File
@@ -39,6 +39,7 @@ use App\Models\UserPref;
use App\Models\Vminfo;
use App\Models\WirelessSensor;
use App\Plugins\Hooks\MenuEntryHook;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use LibreNMS\Config;
@@ -82,7 +83,7 @@ class MenuComposer
$vars['locations'] = (Config::get('show_locations') && Config::get('show_locations_dropdown')) ?
Location::hasAccess($user)->where('location', '!=', '')->orderBy('location')->get(['location', 'id']) :
collect();
new Collection();
$vars['show_vmwinfo'] = Vminfo::hasAccess($user)->exists();
// Service menu
+1 -1
View File
@@ -176,7 +176,7 @@ class PingCheck implements ShouldQueue
// working collections
$this->tiered = $this->devices->groupBy('max_depth', true);
$this->deferred = collect();
$this->deferred = new Collection();
// start with tier 1 (the root nodes, 0 is standalone)
$this->current_tier = 1;
@@ -3,7 +3,7 @@
use LibreNMS\Util\ObjectCache;
if (ObjectCache::serviceCounts(['total'], $device['device_id'])['total'] > 0) {
$colors = collect(['green', 'yellow', 'red']);
$colors = new \Illuminate\Support\Collection(['green', 'yellow', 'red']);
$output = \App\Models\Service::query()
->where('device_id', $device['device_id'])
->orderBy('service_type')
+1 -1
View File
@@ -54,7 +54,7 @@ class PermissionsTest extends TestCase
break;
}
return collect($data);
return new \Illuminate\Support\Collection($data);
}
public function testUserCanAccessDevice()