mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use Collection instead of collect() (#14527)
* Use Collection instead of collect() * wip
This commit is contained in:
@@ -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();
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user