label(__('Synchronize all servers')) ->icon('heroicon-o-refresh') ->requiresConfirmation() ->modalHeading('Synchronize servers') ->modalSubheading('This will synchronize all the servers that are listed in the table, to your Ploi Core installation.') ->action(function () { $availableServers = Ploi::make()->synchronize()->servers()->getData(); foreach ($availableServers as $availableServer) { Server::query() ->updateOrCreate([ 'ploi_id' => $availableServer->id, ], [ 'status' => $availableServer->status, 'name' => $availableServer->name, 'ip' => $availableServer->ip_address, 'ssh_port' => $availableServer->ssh_port, 'internal_ip' => $availableServer->internal_ip, 'available_php_versions' => $availableServer->installed_php_versions, ]); } Notification::make() ->body(__('Servers synchronized successfully.')) ->success() ->send(); }), ]; } }