Files
librenms-librenms/app/Models/Device.php

971 lines
27 KiB
PHP
Raw Normal View History

Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
<?php
namespace App\Models;
use App\View\SimpleTemplate;
use Fico7489\Laravel\Pivot\Traits\PivotEventTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\ModelNotFoundException;
2021-03-30 11:14:34 +02:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
2021-10-03 01:03:24 +02:00
use Illuminate\Database\Eloquent\Relations\HasOne;
2021-03-30 11:14:34 +02:00
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Str;
use LibreNMS\Exceptions\InvalidIpException;
use LibreNMS\Util\IP;
use LibreNMS\Util\IPv4;
use LibreNMS\Util\IPv6;
use LibreNMS\Util\Rewrite;
use LibreNMS\Util\Time;
use LibreNMS\Util\Url;
use Permissions;
2021-03-30 11:14:34 +02:00
/**
* @property-read int|null $ports_count
* @property-read int|null $sensors_count
* @property-read int|null $wirelessSensors_count
2021-09-10 20:09:53 +02:00
*
2021-04-01 00:35:19 +02:00
* @method static \Database\Factories\DeviceFactory factory(...$parameters)
2021-03-30 11:14:34 +02:00
*/
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
class Device extends BaseModel
{
use PivotEventTrait, HasFactory;
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
public $timestamps = false;
protected $primaryKey = 'device_id';
protected $fillable = [
'authalgo',
'authlevel',
'authname',
'authpass',
'community',
'cryptoalgo',
'cryptopass',
'features',
'hardware',
'hostname',
'display',
'icon',
'ip',
'os',
'overwrite_ip',
'poller_group',
'port',
'port_association_mode',
'retries',
'serial',
'snmp_disable',
'snmp_max_repeaters',
'snmpver',
'status',
'status_reason',
'sysDescr',
'sysName',
'sysObjectID',
'timeout',
'transport',
'version',
'uptime',
];
protected $casts = [
'last_polled' => 'datetime',
'status' => 'boolean',
];
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
// ---- Helper Functions ----
public static function findByHostname(string $hostname): ?Device
{
return static::where('hostname', $hostname)->first();
}
/**
* Returns IP/Hostname where polling will be targeted to
*
2021-09-08 23:35:56 +02:00
* @param string|array $device hostname which will be triggered
* array $device associative array with device data
* @return string IP/Hostname to which Device polling is targeted
*/
public static function pollerTarget($device)
{
if (! is_array($device)) {
$ret = static::where('hostname', $device)->first(['hostname', 'overwrite_ip']);
if (empty($ret)) {
return $device;
}
$overwrite_ip = $ret->overwrite_ip;
$hostname = $ret->hostname;
} elseif (array_key_exists('overwrite_ip', $device)) {
$overwrite_ip = $device['overwrite_ip'];
$hostname = $device['hostname'];
} else {
return $device['hostname'];
}
return $overwrite_ip ?: $hostname;
}
public static function findByIp(?string $ip): ?Device
{
if (! IP::isValid($ip)) {
return null;
}
$device = static::where('hostname', $ip)->orWhere('ip', inet_pton($ip))->first();
if ($device) {
return $device;
}
try {
$ipv4 = new IPv4($ip);
$port = Ipv4Address::where('ipv4_address', (string) $ipv4)
->with('port', 'port.device')
->firstOrFail()->port;
if ($port) {
return $port->device;
}
} catch (InvalidIpException $e) {
//
} catch (ModelNotFoundException $e) {
//
}
try {
$ipv6 = new IPv6($ip);
$port = Ipv6Address::where('ipv6_address', $ipv6->uncompressed())
->with(['port', 'port.device'])
->firstOrFail()->port;
if ($port) {
return $port->device;
}
} catch (InvalidIpException $e) {
//
} catch (ModelNotFoundException $e) {
//
}
return null;
}
/**
* Get VRF contexts to poll.
* If no contexts are found, return the default context ''
*
* @return array
*/
public function getVrfContexts(): array
{
return $this->vrfLites->isEmpty() ? [''] : $this->vrfLites->pluck('context_name')->all();
}
/**
* Get the display name of this device based on the display format string
* The default is {{ $hostname }} controlled by the device_display_default setting
*/
public function displayName(): string
{
$hostname_is_ip = IP::isValid($this->hostname);
return SimpleTemplate::parse($this->display ?: \LibreNMS\Config::get('device_display_default', '{{ $hostname }}'), [
'hostname' => $this->hostname,
'sysName' => $this->sysName ?: $this->hostname,
'sysName_fallback' => $hostname_is_ip ? $this->sysName : $this->hostname,
'ip' => $this->overwrite_ip ?: ($hostname_is_ip ? $this->hostname : $this->ip),
]);
}
/**
* Returns the device name if not already displayed
*/
public function name(): string
{
$display = $this->displayName();
if (! Str::contains($display, $this->hostname)) {
2021-11-19 12:21:56 -06:00
return (string) $this->hostname;
} elseif (! Str::contains($display, $this->sysName)) {
2021-11-19 12:21:56 -06:00
return (string) $this->sysName;
}
return '';
}
public function isUnderMaintenance()
{
if (! $this->device_id) {
return false;
}
$query = AlertSchedule::isActive()
->where(function (Builder $query) {
$query->whereHas('devices', function (Builder $query) {
$query->where('alert_schedulables.alert_schedulable_id', $this->device_id);
});
if ($this->groups->isNotEmpty()) {
$query->orWhereHas('deviceGroups', function (Builder $query) {
$query->whereIn('alert_schedulables.alert_schedulable_id', $this->groups->pluck('id'));
});
}
if ($this->location) {
$query->orWhereHas('locations', function (Builder $query) {
$query->where('alert_schedulables.alert_schedulable_id', $this->location->id);
});
}
});
return $query->exists();
}
/**
* Get the shortened display name of this device.
* Length is always overridden by shorthost_target_length.
*
2021-09-08 23:35:56 +02:00
* @param int $length length to shorten to, will not break up words so may be longer
* @return string
*/
public function shortDisplayName($length = 12)
{
$name = $this->displayName();
// IP addresses should not be shortened
if (IP::isValid($name)) {
return $name;
}
$length = \LibreNMS\Config::get('shorthost_target_length', $length);
if ($length < strlen($name)) {
$take = max(substr_count($name, '.', 0, $length), 1);
return implode('.', array_slice(explode('.', $name), 0, $take));
}
return $name;
}
/**
* Check if user can access this device.
*
2021-09-08 23:35:56 +02:00
* @param User $user
* @return bool
*/
public function canAccess($user)
{
if (! $user) {
return false;
}
if ($user->hasGlobalRead()) {
return true;
}
return Permissions::canAccessDevice($this->device_id, $user->user_id);
}
public function formatDownUptime($short = false)
{
$time = ($this->status == 1) ? $this->uptime : time() - strtotime($this->last_polled);
return Time::formatInterval($time, $short);
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
/**
* @return string
*/
public function logo()
{
$base_name = pathinfo($this->icon, PATHINFO_FILENAME);
$options = [
"images/logos/$base_name.svg",
"images/logos/$base_name.png",
"images/os/$base_name.svg",
"images/os/$base_name.png",
];
foreach ($options as $file) {
if (is_file(public_path() . "/$file")) {
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
return asset($file);
}
}
return asset('images/os/generic.svg');
}
/**
* Update the max_depth field based on parents
* Performs SQL query, so make sure all parents are saved first
*
2021-09-08 23:35:56 +02:00
* @param int $exclude exclude a device_id from being considered (used for deleting)
*/
public function updateMaxDepth($exclude = null)
{
// optimize for memory instead of time
$query = $this->parents()->getQuery();
if (! is_null($exclude)) {
$query->where('device_id', '!=', $exclude);
}
$count = $query->count();
if ($count === 0) {
if ($this->children()->count() === 0) {
$this->max_depth = 0; // no children or parents
} else {
$this->max_depth = 1; // has children
}
} else {
$parents_max_depth = $query->max('max_depth');
$this->max_depth = $parents_max_depth + 1;
}
$this->save();
}
/**
* Device dependency check to see if this node is standalone or not.
* Standalone is a special case where the device has no parents or children and is denoted by a max_depth of 0
*
* Only checks on root nodes (where max_depth is 1 or 0)
*/
public function validateStandalone()
{
if ($this->max_depth === 0 && $this->children()->count() > 0) {
$this->max_depth = 1; // has children
} elseif ($this->max_depth === 1 && $this->parents()->count() === 0) {
$this->max_depth = 0; // no children or parents
}
$this->save();
}
public function getAttrib($name)
{
return $this->attribs->pluck('attrib_value', 'attrib_type')->get($name);
}
public function setAttrib($name, $value)
{
$attrib = $this->attribs->first(function ($item) use ($name) {
return $item->attrib_type === $name;
});
if (! $attrib) {
$attrib = new DeviceAttrib(['attrib_type' => $name]);
$this->attribs->push($attrib);
}
$attrib->attrib_value = $value;
return (bool) $this->attribs()->save($attrib);
}
public function forgetAttrib($name)
{
$attrib_index = $this->attribs->search(function ($attrib) use ($name) {
return $attrib->attrib_type === $name;
});
if ($attrib_index !== false) {
$deleted = (bool) $this->attribs->get($attrib_index)->delete();
// only forget the attrib_index after delete, otherwise delete() will fail fatally with:
// Symfony\\Component\\Debug\Exception\\FatalThrowableError(code: 0): Call to a member function delete() on null
$this->attribs->forget((string) $attrib_index);
return $deleted;
}
return false;
}
public function getAttribs()
{
return $this->attribs->pluck('attrib_value', 'attrib_type')->toArray();
}
/**
* Update the location to the correct location and update GPS if needed
*
* @param \App\Models\Location|string $new_location location data
2021-09-08 23:35:56 +02:00
* @param bool $doLookup try to lookup the GPS coordinates
*/
public function setLocation($new_location, bool $doLookup = false)
{
$new_location = $new_location instanceof Location ? $new_location : new Location(['location' => $new_location]);
$new_location->location = $new_location->location ? Rewrite::location($new_location->location) : null;
$coord = array_filter($new_location->only(['lat', 'lng']));
if (! $this->override_sysLocation) {
if (! $new_location->location) { // disassociate if the location name is empty
$this->location()->dissociate();
return;
}
if (! $this->relationLoaded('location') || optional($this->location)->location !== $new_location->location) {
if (! $new_location->exists) { // don't fetch if new location persisted to the DB, just use it
$new_location = Location::firstOrCreate(['location' => $new_location->location], $coord);
}
$this->location()->associate($new_location);
}
}
// set coordinates
if ($this->location && ! $this->location->fixed_coordinates) {
$this->location->fill($coord);
if ($doLookup && empty($coord)) { // only if requested and coordinates not passed explicitly
$this->location->lookupCoordinates($this->hostname);
}
}
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
// ---- Accessors/Mutators ----
public function getIconAttribute($icon): string
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return Str::start(Url::findOsImage($this->os, $this->features, $icon), 'images/os/');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
public function getIpAttribute($ip): ?string
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
if (empty($ip)) {
return null;
}
// @ suppresses warning, inet_ntop() returns false if it fails
return @inet_ntop($ip) ?: null;
}
public function setIpAttribute($ip): void
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
$this->attributes['ip'] = inet_pton($ip);
}
public function setStatusAttribute($status): void
{
$this->attributes['status'] = (int) $status;
}
public function setSysDescrAttribute(?string $sysDescr): void
{
$this->attributes['sysDescr'] = $sysDescr === null ? null : trim(str_replace(chr(218), "\n", $sysDescr), "\\\" \r\n\t\0");
}
public function setSysNameAttribute(?string $sysName): void
{
$this->attributes['sysName'] = $sysName === null ? null : str_replace("\n", '', strtolower(trim($sysName)));
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
// ---- Query scopes ----
public function scopeIsUp($query)
{
return $query->where([
['status', '=', 1],
['ignore', '=', 0],
['disable_notify', '=', 0],
['disabled', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeIsActive($query)
{
return $query->where([
['ignore', '=', 0],
['disabled', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeIsDown($query)
{
return $query->where([
['status', '=', 0],
['disable_notify', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
['ignore', '=', 0],
['disabled', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeIsIgnored($query)
{
return $query->where([
['ignore', '=', 1],
['disabled', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeNotIgnored($query)
{
return $query->where([
['ignore', '=', 0],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeIsDisabled($query)
{
return $query->where([
['disabled', '=', 1],
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
]);
}
public function scopeIsDisableNotify($query)
{
return $query->where([
['disable_notify', '=', 1],
]);
}
public function scopeIsNotDisabled($query)
{
return $query->where([
['disable_notify', '=', 0],
['disabled', '=', 0],
]);
}
public function scopeWhereAttributeDisabled(Builder $query, string $attribute): Builder
{
return $query->leftJoin('devices_attribs', function (JoinClause $query) use ($attribute) {
$query->on('devices.device_id', 'devices_attribs.device_id')
->where('devices_attribs.attrib_type', $attribute);
})->where(function (Builder $query) {
$query->whereNull('devices_attribs.attrib_value')
->orWhere('devices_attribs.attrib_value', '!=', 'true');
});
}
public function scopeWhereUptime($query, $uptime, $modifier = '<')
{
return $query->where([
['uptime', '>', 0],
['uptime', $modifier, $uptime],
]);
}
public function scopeCanPing(Builder $query): Builder
{
return $this->scopeWhereAttributeDisabled($query->where('disabled', 0), 'override_icmp_disable');
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
public function scopeHasAccess($query, User $user)
{
return $this->hasDeviceAccess($query, $user);
}
public function scopeInDeviceGroup($query, $deviceGroup)
{
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
return $query->whereIn(
$query->qualifyColumn('device_id'), function ($query) use ($deviceGroup) {
$query->select('device_id')
->from('device_group_device')
->where('device_group_id', $deviceGroup);
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
}
);
}
public function scopeNotInDeviceGroup($query, $deviceGroup)
{
return $query->whereNotIn(
$query->qualifyColumn('device_id'), function ($query) use ($deviceGroup) {
$query->select('device_id')
->from('device_group_device')
->where('device_group_id', $deviceGroup);
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
}
);
}
public function scopeInServiceTemplate($query, $serviceTemplate)
{
return $query->whereIn(
$query->qualifyColumn('device_id'), function ($query) use ($serviceTemplate) {
$query->select('device_id')
->from('service_templates_device')
->where('service_template_id', $serviceTemplate);
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
}
);
}
public function scopeNotInServiceTemplate($query, $serviceTemplate)
{
return $query->whereNotIn(
$query->qualifyColumn('device_id'), function ($query) use ($serviceTemplate) {
$query->select('device_id')
->from('service_templates_device')
->where('service_template_id', $serviceTemplate);
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
}
);
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
// ---- Define Relationships ----
2021-03-30 11:14:34 +02:00
public function accessPoints(): HasMany
{
return $this->hasMany(AccessPoint::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function alerts(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Alert::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
public function alertLogs(): HasMany
{
return $this->hasMany(\App\Models\AlertLog::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function alertSchedules(): MorphToMany
{
return $this->morphToMany(\App\Models\AlertSchedule::class, 'alert_schedulable', 'alert_schedulables', 'schedule_id', 'schedule_id');
}
2021-03-30 11:14:34 +02:00
public function applications(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Application::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
public function attribs(): HasMany
{
return $this->hasMany(\App\Models\DeviceAttrib::class, 'device_id');
}
public function availability(): HasMany
{
return $this->hasMany(\App\Models\Availability::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function bgppeers(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\BgpPeer::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function cefSwitching(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\CefSwitching::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function children(): BelongsToMany
{
return $this->belongsToMany(self::class, 'device_relationships', 'parent_device_id', 'child_device_id');
}
2021-03-30 11:14:34 +02:00
public function components(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Component::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
public function diskIo(): HasMany
{
return $this->hasMany(\App\Models\DiskIo::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function hostResources(): HasMany
{
return $this->hasMany(HrDevice::class, 'device_id');
}
2021-10-03 01:03:24 +02:00
public function hostResourceValues(): HasOne
{
2021-10-03 01:03:24 +02:00
return $this->hasOne(HrSystem::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function entityPhysical(): HasMany
{
return $this->hasMany(EntPhysical::class, 'device_id');
}
public function entityState(): HasMany
{
return $this->hasMany(EntityState::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function eventlogs(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Eventlog::class, 'device_id', 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function graphs(): HasMany
{
return $this->hasMany(\App\Models\DeviceGraph::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function groups(): BelongsToMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->belongsToMany(\App\Models\DeviceGroup::class, 'device_group_device', 'device_id', 'device_group_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function ipsecTunnels(): HasMany
{
return $this->hasMany(IpsecTunnel::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function ipv4(): HasManyThrough
Graylog entry matching device if source is not hostname or primary ip (#10458) * Added findByHostnameOrIp($hostnameOrIp) for devices. Returns Device or null Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config * Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true" Added code to match Graylog entries by any interface address instead of only hostname or primary address * Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447 * Modified code to reduce complexity as mentioned by codeclimate * Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Added Language File "syslog.php" for Syslog Severity and Facility Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value * Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Add shortcut ipv4 and ipv6 device relationships Better code for adding source addresses Only translate level and facility if they are numeric Allow level and facility to be sortable No need for device link if we know it won't work. Before the code was punting to save sql queries. * Cache devices Took queries from 69 to 6 in my quick test. * Added Documentation for $config['graylog']['match-any-address'] * Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 22:13:35 +02:00
{
return $this->hasManyThrough(\App\Models\Ipv4Address::class, \App\Models\Port::class, 'device_id', 'port_id', 'device_id', 'port_id');
Graylog entry matching device if source is not hostname or primary ip (#10458) * Added findByHostnameOrIp($hostnameOrIp) for devices. Returns Device or null Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config * Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true" Added code to match Graylog entries by any interface address instead of only hostname or primary address * Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447 * Modified code to reduce complexity as mentioned by codeclimate * Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Added Language File "syslog.php" for Syslog Severity and Facility Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value * Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Add shortcut ipv4 and ipv6 device relationships Better code for adding source addresses Only translate level and facility if they are numeric Allow level and facility to be sortable No need for device link if we know it won't work. Before the code was punting to save sql queries. * Cache devices Took queries from 69 to 6 in my quick test. * Added Documentation for $config['graylog']['match-any-address'] * Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 22:13:35 +02:00
}
2021-03-30 11:14:34 +02:00
public function ipv6(): HasManyThrough
Graylog entry matching device if source is not hostname or primary ip (#10458) * Added findByHostnameOrIp($hostnameOrIp) for devices. Returns Device or null Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config * Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true" Added code to match Graylog entries by any interface address instead of only hostname or primary address * Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447 * Modified code to reduce complexity as mentioned by codeclimate * Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Added Language File "syslog.php" for Syslog Severity and Facility Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value * Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Add shortcut ipv4 and ipv6 device relationships Better code for adding source addresses Only translate level and facility if they are numeric Allow level and facility to be sortable No need for device link if we know it won't work. Before the code was punting to save sql queries. * Cache devices Took queries from 69 to 6 in my quick test. * Added Documentation for $config['graylog']['match-any-address'] * Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 22:13:35 +02:00
{
return $this->hasManyThrough(\App\Models\Ipv6Address::class, \App\Models\Port::class, 'device_id', 'port_id', 'device_id', 'port_id');
Graylog entry matching device if source is not hostname or primary ip (#10458) * Added findByHostnameOrIp($hostnameOrIp) for devices. Returns Device or null Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config * Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true" Added code to match Graylog entries by any interface address instead of only hostname or primary address * Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447 * Modified code to reduce complexity as mentioned by codeclimate * Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Added Language File "syslog.php" for Syslog Severity and Facility Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value * Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant * Add shortcut ipv4 and ipv6 device relationships Better code for adding source addresses Only translate level and facility if they are numeric Allow level and facility to be sortable No need for device link if we know it won't work. Before the code was punting to save sql queries. * Cache devices Took queries from 69 to 6 in my quick test. * Added Documentation for $config['graylog']['match-any-address'] * Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 22:13:35 +02:00
}
public function isisAdjacencies(): HasMany
{
return $this->hasMany(\App\Models\IsisAdjacency::class, 'device_id', 'device_id');
}
2021-03-30 11:14:34 +02:00
public function location(): BelongsTo
Refactored and update Location Geocoding (#9359) - Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls) - Parse coordinates from the location more consistently - Add settings to webui - ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~ - Google Maps, Bing, Mapquest, and OpenStreetMap supported initially. - Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though. - All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate) - Update all (I think) sql queries to handle the new structure - Remove final vestiges of override_sysLocation as a device attribute - Update existing device groups and rules in DB - Tested all APIs with good/bad location, no/bad/good key, and no connection. - Cannot fix advanced queries that use location This blocks #8868 DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
{
return $this->belongsTo(\App\Models\Location::class, 'location_id', 'id');
Refactored and update Location Geocoding (#9359) - Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls) - Parse coordinates from the location more consistently - Add settings to webui - ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~ - Google Maps, Bing, Mapquest, and OpenStreetMap supported initially. - Default to OpenStreetMap, which doesn't require a key. They will liberally hand out bans if you exceed 1 query per second though. - All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate) - Update all (I think) sql queries to handle the new structure - Remove final vestiges of override_sysLocation as a device attribute - Update existing device groups and rules in DB - Tested all APIs with good/bad location, no/bad/good key, and no connection. - Cannot fix advanced queries that use location This blocks #8868 DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
2018-11-28 16:49:18 -06:00
}
public function macs(): HasMany
{
return $this->hasMany(Ipv4Mac::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mefInfo(): HasMany
{
return $this->hasMany(MefInfo::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function muninPlugins(): HasMany
{
return $this->hasMany(\App\Models\MuninPlugin::class, 'device_id');
}
public function netscalerVservers(): HasMany
{
return $this->hasMany(NetscalerVserver::class, 'device_id');
}
public function ospfAreas(): HasMany
{
return $this->hasMany(\App\Models\OspfArea::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function ospfInstances(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\OspfInstance::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function ospfNbrs(): HasMany
{
return $this->hasMany(\App\Models\OspfNbr::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function ospfPorts(): HasMany
{
return $this->hasMany(\App\Models\OspfPort::class, 'device_id');
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
2021-03-30 11:14:34 +02:00
public function packages(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Package::class, 'device_id', 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function parents(): BelongsToMany
{
return $this->belongsToMany(self::class, 'device_relationships', 'child_device_id', 'parent_device_id');
}
2021-03-30 11:14:34 +02:00
public function perf(): HasMany
{
return $this->hasMany(\App\Models\DevicePerf::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function ports(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Port::class, 'device_id', 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function portsFdb(): HasMany
{
return $this->hasMany(\App\Models\PortsFdb::class, 'device_id', 'device_id');
}
2021-03-30 11:14:34 +02:00
public function portsNac(): HasMany
{
return $this->hasMany(\App\Models\PortsNac::class, 'device_id', 'device_id');
}
public function portsStp(): HasMany
{
return $this->hasMany(\App\Models\PortStp::class, 'device_id', 'device_id');
}
public function portsVlan(): HasMany
{
return $this->hasMany(\App\Models\PortVlan::class, 'device_id', 'device_id');
}
public function processes(): HasMany
{
return $this->hasMany(\App\Models\Process::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function processors(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Processor::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function routes(): HasMany
{
return $this->hasMany(Route::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function rules(): BelongsToMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->belongsToMany(\App\Models\AlertRule::class, 'alert_device_map', 'device_id', 'rule_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function sensors(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Sensor::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function serviceTemplates(): BelongsToMany
Add Service Templates (#12107) * service templates - move to blade - jellyfrog fixes - revert get to find and fix discovery lookup * service templates - move to blade - wip * service templates - move to blade - wip * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate delete_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - deprecate remove_service_template * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix remove route * service templates - move to blade - fix remove route * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fix permisson lookup * service templates - move to blade - fixs * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - nullable input? * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - add selected for device group id and type * service templates - move to blade - fix discovery response * service templates - move to blade - fix device group index display * service templates - move to blade - add delete to discover_service_template * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - add discover all button - function foobar * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - button fixes * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - attempt route fix * service templates - move to blade - fix discovery function * service templates - move to blade - fix discovery function * service templates - move to blade - fix return values - thanks SourceDoctor * service templates - move to blade - attempt route fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - button variable fix * service templates - move to blade - function fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - move to blade - permissions fix * service templates - add initial api - and model permissions fix * service templates - add initial api - discovery too * service templates - add initial api - discovery too * service templates - merge fix * service templates - api fixes * service templates - api fixes * service templates - remove bad fixe * service templates - discover null? :) * service templates - Policy requires Facade? * service templates - Policy requires Facade? * service templates - REVERT Policy requires Facade? * service templates - REVERT Policy requires Facade? * Revert "service templates - REVERT Policy requires Facade?" This reverts commit 7752b3e4e55f571647dd7e03325e833a6220aa8b. * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - clean up discover api call * service templates - attempt route fix * Revert "service templates - attempt route fix" This reverts commit b48970351e60ab2103fa8e776eda5431af95cd74. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit ef93315db5ff4e47943516209ed0fa7310eb1807. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 73af819a6062c3a671e0927fad8606c0dd756b2c. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit dd019c3105cf185dede00753ec559551e64bdfe0. * Revert "service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template" This reverts commit 94aaaf7976a765140b057a478d92141d9ac97ad4. * service templates - jellyfrog fixes - DeviceGroup relates to Service Template * service templates - fix permissions * service templates - db service_templates_perms * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix permissions * service templates - fix edit.blade missing parameters - still 403 :( * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * service templates - jellyfrog -fix route and construct * Revert "service templates - jellyfrog -fix route and construct" This reverts commit ec1eea7a999659d38be60b33bd54c68f01374528. * service templates - jellyfrog -fix routes * service templates - jellyfrog -fix services lookup * service templates - edit blade fixes * service templates - edit blade fixes - service or services or template or serviceTemplate or service_template good luck * service templates - edit blade fixes * service templates - index blade fixes * service templates - discover return fix * service templates - remove return fix * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery api returns * service templates - fix discovery - test * service templates - fix discovery * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix checkbox integer * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover all * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - fix discover * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - move discover/apply to blade - last of the old functions - wip * service templates - change all relevant to template for sanity * service templates - inspection fixes * service templates - inspection fixes * service templates - inspection fixes * service templates - murrant fixes - use createOrUpdate - add obervers - fix function call * service templates - murrant fixes - add ServiceController store - not used * service templates - murrant fixes - add Observers file) * service templates - murrant fixes - correct ServiceController * service templates - murrant fixes - fix observers load * service templates - observer fix * service templates - schedule discovery function call fix, cheeky, is this allowed? * service templates - attempt route fix. * service templates - attempt route fix 2 * service templates - blade route applyall missing url - ie the route lol * service templates - blade route applyall missing url - ie the route lol * service templates - fix routes - bingo! * service templates - fix routes - bingo! * service templates - fix blade missing quote * service templates - jellyfrog fix - remove pluck * service templates - missing template id on service update * service templates - jellyfrog fix - add get * service templates - fix service db defaults / null * service templates - fix service update * service templates - fix service update * service templates - fix service update * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * service templates - fix service devicegroup change - obsoletes service_template_change in servicesdb * Add service templates - phpcs fixes - and attemp whereNotIn scope * Add service templates - styleci * Add service templates - styleci * Add service templates - fix notindevicegroup scope * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - removed service service_template_changed - not required for delete or update * Add service templates - murrant fixes - add protected casts - fix checkbox * Add service templates - fix checkbox - attempt2 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt3 * Add service templates - fix checkbox - attempt4 * Add service templates - fix delete row selection * Revert "Add service templates - fix delete row selection" This reverts commit 4d9e4990f2535e966b6c86103023df6d1aae4905. * Add service templates - fix delete row selection * Add service templates - fix automatic discovery * Add service templates - fix automatic discovery * Add service templates - checkbox - add hidden input * Add service templates - checkbox - add old value back? * Add service templates - checkbox - fix disabled * Add service templates - checkbox - fix disabled * Add service templates - service fixes - styleci * Add service templates - make devicegroup required * Add service templates - let Disable text wrap * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - dont allow device group to be deleted when service templates exist * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - dbschema - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - db migration - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable multiple device groups - wip * Add service templates - enable service template Groups - relationships to device AND device groups * Add service templates - styleci fixes * Add service templates - styleci fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - fixes * Add service templates - db - primarykey issues * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fix migrations * Add service templates - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - blade view - fixes * Add service templates - misc update for travis build trigger * Add service templates - restrict view to only show device/groups that have templates applied * Add service templates - fix devicegroup update * remove permissions table stuff * Fix schema rollback * fix style * Update ServiceTemplateController.php Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-02-02 06:40:11 +00:00
{
return $this->belongsToMany(\App\Models\ServiceTemplate::class, 'service_templates_device', 'device_id', 'service_template_id');
}
2021-03-30 11:14:34 +02:00
public function services(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Service::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function storage(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Storage::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function stpInstances(): HasMany
{
return $this->hasMany(Stp::class, 'device_id');
}
public function stpPorts(): HasMany
{
return $this->hasMany(\App\Models\PortStp::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mempools(): HasMany
{
return $this->hasMany(\App\Models\Mempool::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsLsps(): HasMany
{
return $this->hasMany(\App\Models\MplsLsp::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsLspPaths(): HasMany
{
return $this->hasMany(\App\Models\MplsLspPath::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsSdps(): HasMany
{
return $this->hasMany(\App\Models\MplsSdp::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsServices(): HasMany
{
return $this->hasMany(\App\Models\MplsService::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsSaps(): HasMany
{
return $this->hasMany(\App\Models\MplsSap::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsSdpBinds(): HasMany
{
return $this->hasMany(\App\Models\MplsSdpBind::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsTunnelArHops(): HasMany
{
return $this->hasMany(\App\Models\MplsTunnelArHop::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function mplsTunnelCHops(): HasMany
{
return $this->hasMany(\App\Models\MplsTunnelCHop::class, 'device_id');
}
public function outages(): HasMany
{
return $this->hasMany(DeviceOutage::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function printerSupplies(): HasMany
{
return $this->hasMany(PrinterSupply::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function pseudowires(): HasMany
{
return $this->hasMany(Pseudowire::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function rServers(): HasMany
{
return $this->hasMany(LoadbalancerRserver::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function slas(): HasMany
{
return $this->hasMany(Sla::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function syslogs(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Syslog::class, 'device_id', 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
public function tnmsNeInfo(): HasMany
{
return $this->hasMany(TnmsneInfo::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function users(): BelongsToMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
// FIXME does not include global read
return $this->belongsToMany(\App\Models\User::class, 'devices_perms', 'device_id', 'user_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function vminfo(): HasMany
{
return $this->hasMany(\App\Models\Vminfo::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function vlans(): HasMany
{
return $this->hasMany(\App\Models\Vlan::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function vrfLites(): HasMany
{
return $this->hasMany(\App\Models\VrfLite::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function vrfs(): HasMany
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
{
return $this->hasMany(\App\Models\Vrf::class, 'device_id');
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}
2021-03-30 11:14:34 +02:00
public function vServers(): HasMany
{
return $this->hasMany(LoadbalancerVserver::class, 'device_id');
}
2021-03-30 11:14:34 +02:00
public function wirelessSensors(): HasMany
{
return $this->hasMany(\App\Models\WirelessSensor::class, 'device_id');
}
Add Laravel to LibreNMS (#8318) * Add Laravel to LibreNMS. * Try to set permissions during initial install and first composer update to Laravel. * Fix composer.lock Fix missing db config keys * Start building v1 layout Port ajax_setresolution, inject csrf into jquery ajax calls Layout works, building menu Partially done. * Fix device group list remove stupid count relationships * Print messages for common boot errors. Don't log to laravel.log file. Log to error_log until booted, then librenms.log * Fix up some issues with Config loading Start of custom directives * Custom blade directives: config, notconfig, admin * Preflight checks Only load config files once. * Update the composer.lock for php 5.6 * Menu through routing * Start of alert menu * Better alert scopes * reduce cruft in models * Alerting menu more or less working :D * Fix style * Improved preflight * Fix chicken-eggs! * Remove examples * Better alert_rule status queries Debugbar * fix app.env check * User Menu * Settings bar (dropped refresh) Search JS * Toastr messages * Rename preflight * Use hasAccess(User) on most models. Add port counts * Missed a Preflight -> Checks rename * Fix some formatting * Boot Eloquent outside of Laravel Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel. Move locate_binary() into Config class * Config WIP * Try to fix a lot of config loading issues. * Improve menu for non-admins removing unneeded menus url() for all in menu * Only use eloquent if it exists * Include APP_URL in initial .env settings * Implement Legacy User Provider * Helper class for using Eloquent outside of Laravel. Allows access to DB style queries too and checking the connection status. * Fix up tests * Fix device groups query * Checking Travis * copy config.test.php earlier * dbFacile check config before connecting Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler. Ignore missing config.php error. * Fix config load with database is not migrated yet. * Remove Config::load() from early boot. * Use laravel config settings to init db (this prefers .env settings) Fix bgp vars not set in menu add _ide_helper.php to .gitignore * Restrict dependencies to versions that support php 5.6 * Update ConfigTest * Fix a couple of installation issues * Add unique NODE_ID to .env * Correct handling of title image * Fix database config not loading. Thanks @laf * Don't prepend / * add class_exists checks for development service providers * Fix config value casting * Don't use functions that may not exist * Update dbFacile.php * d_echo may not be defined when Config used called. * Add SELinux configuration steps More detailed permissions check. Check all and give complete corrective commands in one step. * Ignore node_modules directory * Re-add accidetal removal
2018-05-09 08:05:17 -05:00
}