Files
ntspi-app/app/Containers/Education/Tasks/GetEducationalFormsTask.php
T
2026-03-20 21:47:02 +05:00

27 lines
825 B
PHP
Executable File

<?php
namespace App\Containers\Education\Tasks;
use App\Containers\Education\Models\AdmissionPlan;
use App\Ship\Enums\Education\FormEducation;
use Illuminate\Support\Facades\Cache;
class GetEducationalFormsTask
{
public function run()
{
$cacheKeyForms = 'education_forms_list';
return Cache::remember($cacheKeyForms, now()->addDay(), function () {
return AdmissionPlan::distinct()
->pluck('contests')
->flatten(1)
->filter(fn ($item) => isset($item['form_education']))
->pluck('form_education')
->unique()
->map(fn ($item) => FormEducation::tryFrom((int)$item))
->filter()
->mapWithKeys(fn ($form) => [$form->name => $form->getLabel()]);
});
}
}