add services logic
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\School;
|
||||
|
||||
use App\Models\Configuration;
|
||||
|
||||
class SemesterSelectionService
|
||||
{
|
||||
public function selectedTeacherSemester(): string
|
||||
{
|
||||
$selected = trim((string) (session()->get('teacher_scores_selected_semester') ?? ''));
|
||||
if ($selected !== '') {
|
||||
return $this->normalize($selected);
|
||||
}
|
||||
|
||||
$fallback = trim((string) (session()->get('semester') ?? ''));
|
||||
if ($fallback !== '') {
|
||||
return $this->normalize($fallback);
|
||||
}
|
||||
|
||||
$configSemester = trim((string) (Configuration::getConfig('semester') ?? ''));
|
||||
if ($configSemester !== '') {
|
||||
return $this->normalize($configSemester);
|
||||
}
|
||||
|
||||
return 'Fall';
|
||||
}
|
||||
|
||||
private function normalize(string $value): string
|
||||
{
|
||||
return ucfirst(strtolower($value));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user