Code cleanup
Removed unused osIdAsString function Added return types to some functions
This commit is contained in:
parent
41413a224f
commit
b44b4bb259
|
@ -200,9 +200,8 @@ class ServerController extends Controller
|
||||||
|
|
||||||
public function destroy(Server $server)
|
public function destroy(Server $server)
|
||||||
{
|
{
|
||||||
$items = Server::find($server->id);
|
$item = Server::find($server->id);
|
||||||
|
$item->delete();
|
||||||
$items->delete();
|
|
||||||
|
|
||||||
$p = new Pricing();
|
$p = new Pricing();
|
||||||
$p->deletePricing($server->id);
|
$p->deletePricing($server->id);
|
||||||
|
|
|
@ -25,9 +25,9 @@ class IPs extends Model
|
||||||
DB::table('ips')->where('service_id', '=', $service_id)->delete();
|
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),
|
'id' => Str::random(8),
|
||||||
'service_id' => $service_id,
|
'service_id' => $service_id,
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Pricing extends Model
|
||||||
DB::table('pricings')->where('service_id', '=', $id)->delete();
|
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);
|
$as_usd = $this->convertToUSD($price, $currency);
|
||||||
return self::create([
|
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')
|
return DB::table('pricings')
|
||||||
->where('service_id', $service_id)
|
->where('service_id', $service_id)
|
||||||
|
|
|
@ -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
|
if ($os === 1) {//None
|
||||||
return "<i class='fas fa-expand' title='{$os_name}'></i>";
|
return "<i class='fas fa-expand' title='{$os_name}'></i>";
|
||||||
|
@ -116,70 +116,7 @@ class Server extends Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function osIdAsString($os)
|
public static function tableRowCompare(string $val1, string $val2, string $value_type = '', bool $is_int = true): string
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
//<td class="td-nowrap plus-td">+303<span class="data-type">MBps</span></td>
|
//<td class="td-nowrap plus-td">+303<span class="data-type">MBps</span></td>
|
||||||
$str = '<td class="td-nowrap ';
|
$str = '<td class="td-nowrap ';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user