@@ -150,7 +150,7 @@ |
||
| 150 | 150 | { |
| 151 | 151 | parent::boot(); |
| 152 | 152 | |
| 153 | - static::deleting(function (Device $device) { |
|
| 153 | + static::deleting(function(Device $device) { |
|
| 154 | 154 | // delete related data |
| 155 | 155 | $device->ports()->delete(); |
| 156 | 156 | $device->syslogs()->delete(); |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // return the table filter merged with $filter, fetch from cache if available |
| 65 | - return array_merge($filter, Cache::rememberForever('query_builder_table_filter', function () { |
|
| 65 | + return array_merge($filter, Cache::rememberForever('query_builder_table_filter', function() { |
|
| 66 | 66 | $tableFilter = []; |
| 67 | 67 | $schema = DB::getDoctrineSchemaManager(); |
| 68 | 68 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } elseif ($format == 'csv') { |
| 66 | 66 | return $this->csvSerialize(); |
| 67 | 67 | } |
| 68 | - return null; // shouldn't get here |
|
| 68 | + return null; // shouldn't get here |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | return $this->datatables |
| 41 | 41 | ->eloquent($this->query()) |
| 42 | - ->editColumn('device.hostname', function ($log) { |
|
| 42 | + ->editColumn('device.hostname', function($log) { |
|
| 43 | 43 | $hostname = is_null($log->device) ? trans('devices.text.deleted') : $log->device->hostname; |
| 44 | 44 | return '<a href="'.url("devices/".$log->device_id).'">'.$hostname.'</a>'; |
| 45 | 45 | }) |
| 46 | - ->editColumn('rule.name', function ($log) { |
|
| 46 | + ->editColumn('rule.name', function($log) { |
|
| 47 | 47 | if ($log->rule_id) { |
| 48 | 48 | return '<a href="'.url("alerting/rules/".$log->rule_id).'">'.$log->rule->name.'</a>'; |
| 49 | 49 | } else { |
| 50 | 50 | return trans('alerting.general.text.invalid'); |
| 51 | 51 | } |
| 52 | 52 | }) |
| 53 | - ->editColumn('state', function ($log) { |
|
| 53 | + ->editColumn('state', function($log) { |
|
| 54 | 54 | $icon = ''; |
| 55 | 55 | $colour = ''; |
| 56 | 56 | $text = ''; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | return '<b><span class="fa fa-'.$icon.'" style="color:'.$colour.'"></span> '.$text.'</b>'; |
| 79 | 79 | }) |
| 80 | - ->editColumn('time_logged', function ($log) { |
|
| 80 | + ->editColumn('time_logged', function($log) { |
|
| 81 | 81 | return date('Y-m-d H:i:s', $log->time_logged / 1000); |
| 82 | 82 | }) |
| 83 | 83 | ->make(true); |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | @else |
| 50 | 50 | <div class="label label-default">UNKNOWN</div> |
| 51 | 51 | @endif') |
| 52 | - ->editColumn('rule.name', function ($alert) { |
|
| 52 | + ->editColumn('rule.name', function($alert) { |
|
| 53 | 53 | return '<a href="'.url("alerting/rules/".$alert->rule_id).'">'.$alert->rule->name.'</a>'; |
| 54 | 54 | }) |
| 55 | - ->editColumn('device.hostname', function ($alert) { |
|
| 55 | + ->editColumn('device.hostname', function($alert) { |
|
| 56 | 56 | $hostname = is_null($alert->device) ? trans('devices.text.deleted') : $alert->device->hostname; |
| 57 | 57 | return '<a href="'.url("devices/".$alert->device_id).'">'.$hostname.'</a>'; |
| 58 | 58 | }) |
| 59 | - ->addColumn('actions', function ($alert) { |
|
| 59 | + ->addColumn('actions', function($alert) { |
|
| 60 | 60 | if ($alert->state == 2) { |
| 61 | 61 | $btn = "btn-danger"; |
| 62 | 62 | $icon = "volume-off"; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | return '<a id="alerts-ack" data-id="'.$alert->id.'" data-state="'.$alert->state.'" class="btn btn-xs '.$btn.'"><i class="fa fa-'.$icon.' fa-fw"></i></a>'; |
| 68 | 68 | }) |
| 69 | - ->editColumn('rule.severity', function ($alert) { |
|
| 69 | + ->editColumn('rule.severity', function($alert) { |
|
| 70 | 70 | return $alert->rule->severity; |
| 71 | 71 | }) |
| 72 | 72 | ->make(true); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | foreach (Settings::get('alert.macros.group', []) as $macro => $value) { |
| 175 | - $value = str_replace(['%', '&&', '||'], ['', 'AND', 'OR'], $value); // this might need something more complex |
|
| 175 | + $value = str_replace(['%', '&&', '||'], ['', 'AND', 'OR'], $value); // this might need something more complex |
|
| 176 | 176 | if (!str_contains($macro, ' ')) { |
| 177 | 177 | $pattern = str_replace('macros.'.$macro, '('.$value.')', $pattern); |
| 178 | 178 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $sql = $this->pattern; |
| 299 | 299 | |
| 300 | 300 | // fill in parameters |
| 301 | - foreach ((array)$this->params as $value) { |
|
| 301 | + foreach ((array) $this->params as $value) { |
|
| 302 | 302 | if (!is_numeric($value) && !starts_with($value, "'")) { |
| 303 | 303 | $value = "'".$value."'"; |
| 304 | 304 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $related = $this->getRelation('deviceCountRelation')->first(); |
| 324 | 324 | |
| 325 | 325 | // then return the count directly |
| 326 | - return ($related) ? (int)$related->count : 0; |
|
| 326 | + return ($related) ? (int) $related->count : 0; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | public function query() |
| 54 | 54 | { |
| 55 | - $syslog = Syslog::with(['device' => function ($query) { |
|
| 55 | + $syslog = Syslog::with(['device' => function($query) { |
|
| 56 | 56 | return $query->addSelect(['device_id', 'hostname']); |
| 57 | 57 | }])->select('syslog.*'); |
| 58 | 58 | return $this->applyScopes($syslog); |
@@ -41,21 +41,21 @@ |
||
| 41 | 41 | { |
| 42 | 42 | return $this->datatables |
| 43 | 43 | ->eloquent($this->query()) |
| 44 | - ->editColumn('hostname', function ($data) { |
|
| 44 | + ->editColumn('hostname', function($data) { |
|
| 45 | 45 | $hostname = is_null($data->device) ? trans('devices.text.deleted') : $data->device->hostname; |
| 46 | 46 | return '<a href="'.url("devices/".$data->device_id).'">'.$hostname.'</a>'; |
| 47 | 47 | }) |
| 48 | - ->editColumn('ifName', function ($data) { |
|
| 48 | + ->editColumn('ifName', function($data) { |
|
| 49 | 49 | $ifName = is_null($data->ifName) ? trans('devices.text.deleted') : $data->ifName; |
| 50 | 50 | return '<a href="'.url("devices/".$data->device_id."/ports/".$data->port_id).'">'.$ifName.'</a>'; |
| 51 | 51 | }) |
| 52 | - ->addColumn('remote_device', function ($data) { |
|
| 52 | + ->addColumn('remote_device', function($data) { |
|
| 53 | 53 | $remote_device = IPv4::where('ipv4_addresses.ipv4_address', $data->ipv4_address)->with('port.device')->first(); |
| 54 | 54 | $remote_id = empty($remote_device->port->device->device_id) ? '' : $remote_device->port->device->device_id; |
| 55 | 55 | $remote_hostname = empty($remote_device->port->device->hostname) ? '' : $remote_device->port->device->hostname; |
| 56 | 56 | return '<a href="'.url("devices/".$remote_id).'">'.$remote_hostname.'</a>'; |
| 57 | 57 | }) |
| 58 | - ->addColumn('remote_interface', function ($data) { |
|
| 58 | + ->addColumn('remote_interface', function($data) { |
|
| 59 | 59 | $remote_device = IPv4::where('ipv4_addresses.ipv4_address', $data->ipv4_address)->with('port.device')->first(); |
| 60 | 60 | $remote_id = empty($remote_device->port->device->device_id) ? '' : $remote_device->port->device->device_id; |
| 61 | 61 | $remote_port_id = empty($remote_device->port->port_id) ? '' : $remote_device->port->port_id; |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | return $this->datatables |
| 41 | 41 | ->eloquent($this->query()) |
| 42 | - ->editColumn('level', function ($user) { |
|
| 42 | + ->editColumn('level', function($user) { |
|
| 43 | 43 | return trans('user.level.'.$user->level); |
| 44 | 44 | }) |
| 45 | 45 | ->editColumn('actions', 'datatables.user.actions') |