Config class collides with Config in model namespace

This commit is contained in:
Tony Murray
2018-09-21 10:08:17 -05:00
parent 5bf4ca2b6c
commit d9e5b425b3

View File

@@ -3,10 +3,9 @@
namespace App\Models;
use Fico7489\Laravel\Pivot\Traits\PivotEventTrait;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Query\JoinClause;
use LibreNMS\Config;
use LibreNMS\Exceptions\InvalidIpException;
use LibreNMS\Util\IP;
use LibreNMS\Util\IPv4;
@@ -144,7 +143,7 @@ class Device extends BaseModel
*/
public function displayName()
{
if (Config::get('force_ip_to_sysname') && $this->sysName && IP::isValid($this->hostname)) {
if (\LibreNMS\Config::get('force_ip_to_sysname') && $this->sysName && IP::isValid($this->hostname)) {
return $this->sysName;
}
@@ -167,7 +166,7 @@ class Device extends BaseModel
return $name;
}
$length = Config::get('shorthost_target_length', $length);
$length = \LibreNMS\Config::get('shorthost_target_length', $length);
if ($length < strlen($name)) {
$take = substr_count($name, '.', 0, $length) + 1;
return implode('.', array_slice(explode('.', $name), 0, $take));