This commit is contained in:
pbao9
2026-02-03 16:10:49 +07:00
parent 6178a76eee
commit 0dbd9bfebe
12 changed files with 446 additions and 206 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Enums\Product;
enum ProductBillingCycle: string
{
case ONE_TIME = 'onetime';
case MONTHLY = 'monthly';
case QUARTERLY = 'quarterly';
case SEMI_ANNUALLY = 'semiannually';
case ANNUALLY = 'annually';
case BIENNIALLY = 'biennially';
case TRIENNIALLY = 'triennially';
public function label(): string
{
return match ($this) {
self::ONE_TIME => 'One Time',
self::MONTHLY => 'Monthly',
self::QUARTERLY => 'Quarterly',
self::SEMI_ANNUALLY => 'Semi Annually',
self::ANNUALLY => 'Annually',
self::BIENNIALLY => 'Biennially',
self::TRIENNIALLY => 'Triennially',
};
}
public function months(): int
{
return match ($this) {
self::ONE_TIME => 0,
self::MONTHLY => 1,
self::QUARTERLY => 3,
self::SEMI_ANNUALLY => 6,
self::ANNUALLY => 12,
self::BIENNIALLY => 24,
self::TRIENNIALLY => 36,
};
}
}
@@ -166,11 +166,12 @@ class IPMapping extends Controller
);
return DataTables::eloquent($query)
->addColumn(
'action',
fn($d) =>
'<a href="' . route('package.ipaddress.edit', $d->id) . '" class="btn btn-primary btn-sm">Edit</a>'
)
->addColumn('action', function ($d) {
return view('administrator.pages.package.ipaddress.datatable.action', [
'id' => $d->id,
'ip' => $d->ip
])->render();
})
->filterColumn('host.datacenter.v_center.host', function ($query, $keyword) {
$query->whereHas('host.datacenter.vCenter', function ($q) use ($keyword) {
$q->where('host', 'like', "%{$keyword}%");