This commit is contained in:
@@ -12,6 +12,16 @@ if (!function_exists('getSemester')) {
|
||||
|
||||
if (!function_exists('getSchoolYear')) {
|
||||
function getSchoolYear() {
|
||||
if (! is_cli() && session()->get('user_id')) {
|
||||
try {
|
||||
return service('schoolYearContext')->resolve(service('request'))->yearName();
|
||||
} catch (\Throwable $e) {
|
||||
log_message('warning', 'Falling back to configured school year: {message}', [
|
||||
'message' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$configModel = new \App\Models\ConfigurationModel();
|
||||
return $configModel->getConfig('school_year');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user