add controllers, servoices
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Assignment;
|
||||
|
||||
use App\Models\Configuration;
|
||||
|
||||
class AssignmentContextService
|
||||
{
|
||||
public function __construct(private Configuration $configuration) {}
|
||||
|
||||
public function getCurrentSemester(): string
|
||||
{
|
||||
return (string) ($this->getConfigValue('semester') ?? '');
|
||||
}
|
||||
|
||||
public function getCurrentSchoolYear(): string
|
||||
{
|
||||
return (string) ($this->getConfigValue('school_year') ?? '');
|
||||
}
|
||||
|
||||
private function getConfigValue(string $key): mixed
|
||||
{
|
||||
return $this->configuration
|
||||
->newQuery()
|
||||
->where('config_key', $key)
|
||||
->value('config_value');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user