orderBy($array[0], $array[1]); } }); } public static function allServers() {//All servers and relationships (no using joins) return Cache::remember("all_servers", now()->addMonth(1), function () { return Server::with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels'])->get(); }); } public static function server(string $server_id) {//Single server and relationships (no using joins) return Cache::remember("server.$server_id", now()->addMonth(1), function () use ($server_id) { return Server::where('id', $server_id) ->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels'])->first(); }); } public static function allActiveServers() {//All ACTIVE servers and relationships replaces activeServersDataIndexPage() return Cache::remember("all_active_servers", now()->addMonth(1), function () { return Server::where('active', '=', 1) ->with(['location', 'provider', 'os', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels', 'price'])->get(); }); } public static function allNonActiveServers() {//All NON ACTIVE servers and relationships replaces nonActiveServersDataIndexPage() return Cache::remember("non_active_servers", now()->addMonth(1), function () { return Server::where('active', '=', 0) ->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels']) ->get(); }); } public static function allPublicServers() {//server data that will be publicly viewable (values in settings) return Cache::remember("public_server_data", now()->addMonth(1), function () { return Server::where('show_public', '=', 1) ->with(['location', 'provider', 'os', 'price', 'ips', 'yabs', 'yabs.disk_speed', 'yabs.network_speed', 'labels']) ->get(); }); } public static function serviceServerType(int $type, bool $short = true): string { if ($type === 1) { return "KVM"; } elseif ($type === 2) { return "OVZ"; } elseif ($type === 3) { if (!$short) { return "Dedicated"; } return "DEDI"; } elseif ($type === 4) { return "LXC"; } elseif ($type === 6) { return "VMware"; } elseif ($type === 7) { return "NAT"; } else { if (!$short) { return "Semi-dedicated"; } return "SEMI-DEDI"; } } public static function osIntToIcon(int $os, string $os_name): string { if ($os === 1) {//None return ""; } else if ($os <= 3) {//Centos return ""; } elseif ($os > 7 && $os <= 11) {//Debain return ""; } elseif ($os > 12 && $os < 15) {//Fedora return ""; } elseif ($os > 14 && $os < 18) {//FreeBSD return ""; } elseif ($os > 17 && $os < 21) {//OpenBSD return ""; } elseif ($os > 25 && $os < 32) {//Ubuntu return ""; } elseif ($os > 32 && $os < 38) {//Windows return ""; } else {//OTHER ISO CUSTOM etc return ""; } } public static function tableRowCompare(string $val1, string $val2, string $value_type = '', bool $is_int = true): string { //