diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index b5bd6d3..882d80d 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -200,9 +200,8 @@ class ServerController extends Controller public function destroy(Server $server) { - $items = Server::find($server->id); - - $items->delete(); + $item = Server::find($server->id); + $item->delete(); $p = new Pricing(); $p->deletePricing($server->id); diff --git a/app/Models/IPs.php b/app/Models/IPs.php index cf14220..882c660 100644 --- a/app/Models/IPs.php +++ b/app/Models/IPs.php @@ -25,9 +25,9 @@ class IPs extends Model DB::table('ips')->where('service_id', '=', $service_id)->delete(); } - public static function insertIP(string $service_id, string $address) + public static function insertIP(string $service_id, string $address): IPs { - self::create( + return self::create( [ 'id' => Str::random(8), 'service_id' => $service_id, diff --git a/app/Models/Pricing.php b/app/Models/Pricing.php index 32ea3ed..867d9c3 100644 --- a/app/Models/Pricing.php +++ b/app/Models/Pricing.php @@ -109,7 +109,7 @@ class Pricing extends Model DB::table('pricings')->where('service_id', '=', $id)->delete(); } - public function insertPricing(int $type, string $service_id, string $currency, float $price, int $term, string $next_due_date, int $is_active = 1) + public function insertPricing(int $type, string $service_id, string $currency, float $price, int $term, string $next_due_date, int $is_active = 1): Pricing { $as_usd = $this->convertToUSD($price, $currency); return self::create([ @@ -125,7 +125,7 @@ class Pricing extends Model ]); } - public function updatePricing(string $service_id, string $currency, float $price, int $term, float $as_usd, string $next_due_date, int $is_active = 1) + public function updatePricing(string $service_id, string $currency, float $price, int $term, float $as_usd, string $next_due_date, int $is_active = 1): int { return DB::table('pricings') ->where('service_id', $service_id) diff --git a/app/Models/Server.php b/app/Models/Server.php index 0d059ed..4bdff9a 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -93,7 +93,7 @@ class Server extends Model } } - public static function osIntToIcon(int $os, string $os_name) + public static function osIntToIcon(int $os, string $os_name): string { if ($os === 1) {//None return ""; @@ -116,70 +116,7 @@ class Server extends Model } } - public static function osIdAsString($os) - { - if ($os === "0") { - return "None"; - } elseif ($os === "1") { - return "CentOS 7"; - } elseif ($os === "2") { - return "CentOS 8"; - } elseif ($os === "3") { - return "CentOS"; - } elseif ($os === "4") { - return "Debian 9"; - } elseif ($os === "5") { - return "Debian 10"; - } elseif ($os === "6") { - return "Debian"; - } elseif ($os === "7") { - return "Fedora 32"; - } elseif ($os === "8") { - return "Fedora 33"; - } elseif ($os === "9") { - return "Fedora"; - } elseif ($os === "10") { - return "FreeBSD 11.4"; - } elseif ($os === "11") { - return "FreeBSD 12.1"; - } elseif ($os === "12") { - return "FreeBSD"; - } elseif ($os === "13") { - return "OpenBSD 6.7"; - } elseif ($os === "14") { - return "OpenBSD 6.8"; - } elseif ($os === "15") { - return "OpenBSD"; - } elseif ($os == "16") { - return "Ubuntu 16.04"; - } elseif ($os === "17") { - return "Ubuntu 18.04"; - } elseif ($os === "18") { - return "Ubuntu 20.04"; - } elseif ($os === "19") { - return "Ubuntu 20.10"; - } elseif ($os === "20") { - return "Ubuntu"; - } elseif ($os === "21") { - return "Windows Server 2008"; - } elseif ($os === "22") { - return "Windows Server 2012"; - } elseif ($os === "23") { - return "Windows Server 2016"; - } elseif ($os === "24") { - return "Windows Server 2019"; - } elseif ($os === "25") { - return "Windows 10"; - } elseif ($os === "26") { - return "Custom"; - } elseif ($os === "27") { - return "Other"; - } else { - return "Unknown"; - } - } - - public static function tableRowCompare(string $val1, string $val2, string $value_type = '', bool $is_int = true) + public static function tableRowCompare(string $val1, string $val2, string $value_type = '', bool $is_int = true): string { //+303MBps $str = '