add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,27 @@
<?php
namespace App\Services\Discounts;
use App\Models\DiscountUsage;
use App\Models\User;
class DiscountParentService
{
public function listParentsWithDiscounts(string $schoolYear): array
{
$parents = User::getParents();
foreach ($parents as &$parent) {
$total = DiscountUsage::getTotalDiscountByParentIdAndSchoolYear(
(int) ($parent['id'] ?? 0),
$schoolYear
);
$parent['total_discount'] = $total;
$parent['has_discount'] = $total > 0 ? 1 : 0;
}
unset($parent);
return $parents;
}
}