update rm deadcode

This commit is contained in:
baodev0
2026-09-27 11:42:40 +07:00
parent 82a71244ca
commit 3af59bd9c5
129 changed files with 5194 additions and 2698 deletions
+8 -10
View File
@@ -2,6 +2,7 @@
namespace App\Helpers;
use App\Enums\Product\ProductBillingCycle;
use App\Models\Invoice;
use App\Models\Order;
use Illuminate\Support\Str;
@@ -31,17 +32,14 @@ class OrderHelper
return $number;
}
/** Number of months a billing_cycle value represents (used for pricing and expires_at math). */
/**
* @throws \InvalidArgumentException
*/
public static function cycleToMonths(?string $cycle): int
{
return match ($cycle) {
'monthly' => 1,
'quarterly' => 3,
'semi_annually' => 6,
'annually' => 12,
'biennially' => 24,
'triennially' => 36,
default => 1,
};
$enum = ProductBillingCycle::tryFrom($cycle ?? '')
?? throw new \InvalidArgumentException("Unknown billing cycle: " . ($cycle ?? 'null'));
return $enum === ProductBillingCycle::ONE_TIME ? 1 : $enum->months();
}
}