Zero datausage if expired

This commit is contained in:
Ibnu Maksum
2024-08-09 14:41:06 +07:00
parent 3f5ea7251e
commit 85ede07d77
2 changed files with 10 additions and 1 deletions

View File

@ -25,6 +25,15 @@ class RadiusRest {
// Remove Customer to Mikrotik/Device
function remove_customer($customer, $plan)
{
// set zero data usage
if ($plan['typebp'] == "Limited" && ($plan['limit_type'] == "Data_Limit" || $plan['limit_type'] == "Both_Limit")) {
$cs = ORM::for_table("rad_acct")->where('username', $customer['username'])->findMany();
foreach ($cs as $c) {
$c->acctOutputOctets = 0;
$c->acctInputOctets = 0;
$c->save();
}
}
}
// customer change username