58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Fees;
|
|
|
|
use App\Models\Configuration;
|
|
|
|
class FeeConfigService
|
|
{
|
|
public function getSchoolYear(): string
|
|
{
|
|
return (string) (Configuration::getConfig('school_year') ?? '');
|
|
}
|
|
|
|
public function getRefundDeadline(): ?string
|
|
{
|
|
$raw = (string) (Configuration::getConfig('refund_deadline') ?? '');
|
|
if ($raw === '') {
|
|
return null;
|
|
}
|
|
|
|
$timestamp = strtotime($raw);
|
|
if ($timestamp === false) {
|
|
return null;
|
|
}
|
|
|
|
return date('Y-m-d', $timestamp);
|
|
}
|
|
|
|
public function getWeeksOfStudy(): float
|
|
{
|
|
return (float) (Configuration::getConfig('weeks_study') ?? 8);
|
|
}
|
|
|
|
public function getSchoolEndDate(): ?string
|
|
{
|
|
$raw = (string) (Configuration::getConfig('last_school_day') ?? '');
|
|
if ($raw === '') {
|
|
return null;
|
|
}
|
|
|
|
$timestamp = strtotime($raw);
|
|
if ($timestamp === false) {
|
|
return null;
|
|
}
|
|
|
|
return date('Y-m-d', $timestamp);
|
|
}
|
|
|
|
public function getFees(): array
|
|
{
|
|
return [
|
|
'first_student_fee' => (float) (Configuration::getConfig('first_student_fee') ?? 350),
|
|
'second_student_fee' => (float) (Configuration::getConfig('second_student_fee') ?? 200),
|
|
'youth_fee' => (float) (Configuration::getConfig('youth_fee') ?? 180),
|
|
];
|
|
}
|
|
}
|