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

View File

@@ -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();

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