This commit is contained in:
Jellyfrog 2022-11-07 19:19:01 +01:00
parent 0d465ebaaf
commit cf5ed4fb51
14 changed files with 20 additions and 18 deletions

View File

@ -88,7 +88,6 @@ class ObjectCache implements ArrayAccess
* Get Data-Object
*
* @param mixed $obj Name of Data-Object
* @return mixed
*/
public function offsetGet($obj): mixed
{
@ -106,6 +105,7 @@ class ObjectCache implements ArrayAccess
return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
}
}
return;
}
//end offsetGet()

View File

@ -10,7 +10,6 @@ class Handler extends ExceptionHandler
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
@ -50,7 +49,7 @@ class Handler extends ExceptionHandler
// try to upgrade generic exceptions to more specific ones
if (! config('app.debug')) {
if ($exception instanceof \Illuminate\View\ViewException || $exception instanceof \Facade\Ignition\Exceptions\ViewException) {
if ($exception instanceof \Illuminate\View\ViewException || $exception instanceof \Spatie\LaravelIgnition\Exceptions\ViewException) {
$base = $exception->getPrevious(); // get real exception
}

View File

@ -57,20 +57,20 @@ class DeviceSearchController extends SearchController
$baseQuery->leftJoin('ports', 'ports.device_id', '=', 'devices.device_id')
->leftJoin('ipv4_addresses', 'ipv4_addresses.port_id', 'ports.port_id');
$query->orWhere('ipv4_address', '=', $search)
$query->orWhere('ipv4_addresses.ipv4_address', '=', $search)
->orWhere('overwrite_ip', '=', $search)
->orWhere('ip', '=', inet_pton($search));
} elseif (\LibreNMS\Util\IPv6::isValid($search, false)) {
$baseQuery->leftJoin('ports', 'ports.device_id', '=', 'devices.device_id')
->leftJoin('ipv6_addresses', 'ipv6_addresses.port_id', 'ports.port_id');
$query->orWhere('ipv6_address', '=', $search)
$query->orWhere('ipv6_addresses.ipv6_address', '=', $search)
->orWhere('overwrite_ip', '=', $search)
->orWhere('ip', '=', inet_pton($search));
} elseif (ctype_xdigit($mac_search = str_replace([':', '-', '.'], '', $search))) {
$baseQuery->leftJoin('ports', 'ports.device_id', '=', 'devices.device_id');
$query->orWhere('ifPhysAddress', 'LIKE', "%$mac_search%");
$query->orWhere('ports.ifPhysAddress', 'LIKE', "%$mac_search%");
}
return $query;

View File

@ -65,7 +65,7 @@ class RegisterController extends Controller
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'realname' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);

View File

@ -126,7 +126,7 @@ class InstallationController extends Controller
$db['port'] ?? 3306,
$db['socket'] ?? null
);
config(['database.default', $this->connection]);
config('database.default', $this->connection);
}
}

View File

@ -107,8 +107,8 @@ class PortsController extends TableController
->where('deleted', $request->get('deleted', 0)) // always filter deleted
->when($request->get('hostname'), function (Builder $query, $hostname) {
$query->where(function (Builder $query) use ($hostname) {
$query->where('hostname', 'like', "%$hostname%")
->orWhere('sysName', 'like', "%$hostname%");
$query->where('devices.hostname', 'like', "%$hostname%")
->orWhere('devices.sysName', 'like', "%$hostname%");
});
})
->when($request->get('ifAlias'), function (Builder $query, $ifAlias) {

View File

@ -28,7 +28,7 @@ namespace App\Logging\Reporting\Middleware;
use LibreNMS\Util\Git;
use Spatie\FlareClient\Report;
class AddGitInformation
class AddGitInformation implements \Spatie\FlareClient\FlareMiddleware\FlareMiddleware
{
/**
* @param \Spatie\FlareClient\Report $report

View File

@ -27,7 +27,7 @@ namespace App\Logging\Reporting\Middleware;
use Spatie\FlareClient\Report;
class CleanContext
class CleanContext implements \Spatie\FlareClient\FlareMiddleware\FlareMiddleware
{
/**
* Middleware to remove sensitive data from the context.

View File

@ -28,7 +28,7 @@ namespace App\Logging\Reporting\Middleware;
use LibreNMS\Util\Version;
use Spatie\FlareClient\Report;
class SetGroups
class SetGroups implements \Spatie\FlareClient\FlareMiddleware\FlareMiddleware
{
/**
* Middleware to set LibreNMS and Tools grouping data

View File

@ -25,11 +25,11 @@ namespace App\Logging\Reporting\Middleware;
use App\Providers\ErrorReportingProvider;
use Spatie\FlareClient\Report;
class SetInstanceId
class SetInstanceId implements \Spatie\FlareClient\FlareMiddleware\FlareMiddleware
{
/**
* Middleware to add instance ID, piggybacks on the "user id" feature.
*
*
* @param \Spatie\FlareClient\Report $report
* @param callable $next
* @return mixed

View File

@ -26,6 +26,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\Relations\HasMany;
class AlertTemplate extends BaseModel
{
@ -33,7 +34,7 @@ class AlertTemplate extends BaseModel
// ---- Define Relationships ----
public function map()
public function map(): HasMany
{
return $this->hasMany(\App\Models\AlertTemplateMap::class, 'alert_templates_id', 'id');
}

View File

@ -162,7 +162,7 @@ class ServiceTemplate extends BaseModel
}
$template_ids = static::query()
->with(['device_groups' => function ($query) {
->with(['groups' => function ($query) {
$query->select('device_groups.id');
}])
->get()

View File

@ -12,7 +12,7 @@ class AuthServiceProvider extends ServiceProvider
/**
* The policy mappings for the application.
*
* @var array
* @var array<class-string, class-string>
*/
protected $policies = [
\App\Models\User::class => \App\Policies\UserPolicy::class,

View File

@ -12,6 +12,7 @@ class UpdateUsersWidgetsSettings extends Migration
*/
public function up()
{
/** @phpstan-ignore-next-line */
$widgets = UserWidget::where('widget_id', 1)->get();
foreach ($widgets as $widget) {
$settings = $widget->settings;
@ -31,6 +32,7 @@ class UpdateUsersWidgetsSettings extends Migration
*/
public function down()
{
/** @phpstan-ignore-next-line */
$widgets = UserWidget::where('widget_id', 1)->get();
foreach ($widgets as $widget) {
$settings = $widget->settings;