diff --git a/app/Http/Controllers/HostController.php b/app/Http/Controllers/HostController.php index 4a640a9..4858386 100644 --- a/app/Http/Controllers/HostController.php +++ b/app/Http/Controllers/HostController.php @@ -19,18 +19,21 @@ public function sync() $zabbix->connect("spaninger", "*"); foreach ( $zabbix->maintenances([ "selectTimeperiods" => "extend" ]) as $maintennace ) { - if(!Carbon::createFromTimestamp($maintennace['active_till'])->isPast()){ - dd(Carbon::createFromTimestamp($maintennace['active_till'])); + if(Carbon::createFromTimestamp($maintennace['active_till'])->isPast()){ + continue; } + + dd(Carbon::createFromTimestamp($maintennace['active_till'])); } foreach ($zabbix->hosts() as $host) { Host::updateOrCreate([ - "hostname" => $host['host'], + "hostname" => $host['host'], ], [ - "display_name" => $host['name'], + "display_name" => $host['name'], ]); } + return redirect()->back(); } }