Active' :
'InActive';
}
public function billing_cycle($billing = 0): string
{
return match ($billing) {
1 => "One Time",
2 => "Monthly",
3 => "Quarterly",
4 => "Semi-Annually",
5 => "Annually",
default => "Free"
};
}
public static function OrderStatus($status = 0): string
{
switch ($status) {
case 1:
$html = 'Active';
break;
case 2:
$html = 'Cancel';
break;
case 3:
$html = 'Processing';
break;
default:
$html = 'Pending';
break;
}
return $html;
}
public function general_password(): string
{
$Upcapt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$lowCapt = "abcdefghijklmnopqrstuvwxyz";
$has = "@#%^&*123";
$result = "";
for ($i = 1; $i <= 4; $i++) {
$result .= substr($Upcapt, (rand() % (strlen($Upcapt))), 1) . substr(
$lowCapt,
(rand() % (strlen($lowCapt))),
1
) . substr($has, (rand() % (strlen($has))), 1);
}
return $result;
}
public static function generateUniqueCode(): string
{
do {
$code = 'ORD-' . strtoupper(\Illuminate\Support\Str::random(8));
} while (Order::where('order_num', $code)->exists());
return $code;
}
}