Replace Auth > Illuminate\Support\Facades\Auth (#12664)

Helps phpstan
This commit is contained in:
Jellyfrog
2021-03-31 21:30:04 +02:00
committed by GitHub
parent 58af994c6b
commit 24c8513029
13 changed files with 16 additions and 13 deletions

View File

@@ -26,9 +26,9 @@ namespace App;
use App\Models\Device;
use App\Models\Notification;
use Auth;
use Cache;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Config;
use Toastr;

View File

@@ -24,7 +24,7 @@
namespace App\Facades;
use Auth;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Enum\Alert;
class LogManager extends \Illuminate\Log\LogManager

View File

@@ -5,11 +5,11 @@ namespace App\Http\Controllers;
use App\Facades\DeviceCache;
use App\Models\Device;
use App\Models\Vminfo;
use Auth;
use Carbon\Carbon;
use Gate;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Config;
use LibreNMS\Util\Graph;
use LibreNMS\Util\Url;

View File

@@ -27,8 +27,8 @@ namespace App\Http\Controllers\Form;
use App\Http\Controllers\Controller;
use App\Models\Dashboard;
use App\Models\UserWidget;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CopyDashboardController extends Controller
{

View File

@@ -11,8 +11,8 @@ use App\Models\Syslog;
use App\Models\User;
use App\Models\UserPref;
use App\Models\Widget;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Config;
use Toastr;

View File

@@ -27,6 +27,7 @@ namespace App\Http\Controllers\Table;
use App\Models\Device;
use App\Models\Location;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Config;
use LibreNMS\Util\Rewrite;
use LibreNMS\Util\Time;
@@ -303,7 +304,7 @@ class DeviceController extends TableController
if ($server = Config::get('gateone.server')) {
if (Config::get('gateone.use_librenms_user')) {
$actions .= '<div class="col-xs-1"><a href="' . $server . '?ssh=ssh://' . \Auth::user()->username . '@' . $device->hostname . '&location=' . $device->hostname . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device->hostname . '"></i></a></div>';
$actions .= '<div class="col-xs-1"><a href="' . $server . '?ssh=ssh://' . Auth::user()->username . '@' . $device->hostname . '&location=' . $device->hostname . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device->hostname . '"></i></a></div>';
} else {
$actions .= '<div class="col-xs-1"><a href="' . $server . '?ssh=ssh://' . $device->hostname . '&location=' . $device->hostname . '" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device->hostname . '"></i></a></div>';
}

View File

@@ -27,8 +27,8 @@ namespace App\Http\Controllers;
use App\Models\Dashboard;
use App\Models\Device;
use App\Models\UserPref;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
use LibreNMS\Authentication\LegacyAuth;
use LibreNMS\Authentication\TwoFactor;

View File

@@ -29,11 +29,11 @@ use App\Models\Mempool;
use App\Models\Port;
use App\Models\Processor;
use App\Models\Storage;
use Auth;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use LibreNMS\Util\Html;
use LibreNMS\Util\StringHelpers;

View File

@@ -3,8 +3,8 @@
namespace App\Http\Middleware;
use App\Models\User;
use Auth;
use Closure;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Authentication\LegacyAuth;
class LegacyExternalAuth

View File

@@ -36,7 +36,7 @@ use App\Models\User;
use App\Models\UserPref;
use App\Models\Vminfo;
use App\Models\WirelessSensor;
use Auth;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use LibreNMS\Config;
use LibreNMS\Util\ObjectCache;

View File

@@ -26,6 +26,7 @@ namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Support\Facades\Auth;
use LibreNMS\Enum\Alert;
class Eventlog extends DeviceRelatedModel
@@ -54,7 +55,7 @@ class Eventlog extends DeviceRelatedModel
'datetime' => Carbon::now(),
'severity' => $severity,
'message' => $text,
'username' => (class_exists('\Auth') && \Auth::check()) ? \Auth::user()->username : '',
'username' => (class_exists('\Auth') && Auth::check()) ? Auth::user()->username : '',
]);
if ($device instanceof Device) {

View File

@@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class Notification extends Model
@@ -61,7 +62,7 @@ class Notification extends Model
{
if ($enabled === true) {
$read = new NotificationAttrib;
$read->user_id = \Auth::user()->user_id;
$read->user_id = Auth::user()->user_id;
$read->key = $name;
$read->value = '1';
$this->attribs()->save($read);

View File

@@ -3,8 +3,8 @@
namespace App\Providers;
use App\Guards\ApiTokenGuard;
use Auth;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider