fix bugs and deletes unnecessary files
This commit is contained in:
@@ -26,7 +26,7 @@ class ClientAdditionalEducationController extends Controller
|
||||
public function __construct(readonly SeoPageProvider $seoPageProvider){}
|
||||
|
||||
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): \Inertia\Response
|
||||
{
|
||||
$cacheKey = md5(serialize([
|
||||
'direction' => $request->input('direction'),
|
||||
@@ -134,26 +134,22 @@ class ClientAdditionalEducationController extends Controller
|
||||
'seo'
|
||||
));
|
||||
}
|
||||
public function show(string $slug)
|
||||
public function show(string $slug): \Inertia\Response
|
||||
{
|
||||
// Кешируем основную программу дополнительного образования
|
||||
[$additionalEducation, $seo] = Cache::remember(
|
||||
$additionalEducationModel = Cache::remember(
|
||||
CacheKeys::ADDITIONAL_EDUCATIONAL_PROGRAM_PREFIX->value . $slug,
|
||||
now()->addDay(),
|
||||
function () use ($slug) {
|
||||
$additionalEducation = AdditionalEducation::query()
|
||||
->with('category.direction')
|
||||
->where('slug', $slug)
|
||||
->first();
|
||||
$seo = $this->seoPageProvider->getSeoForModel($additionalEducation);
|
||||
return [
|
||||
new AdditionalEducationResource($additionalEducation),
|
||||
$seo
|
||||
];
|
||||
}
|
||||
fn() => AdditionalEducation::with('category.direction')->where('slug', $slug)->firstOrFail()
|
||||
);
|
||||
|
||||
// SEO-данные берём из кешированного ресурса
|
||||
$seo = Cache::remember(
|
||||
CacheKeys::ADDITIONAL_EDUCATIONAL_PROGRAM_PREFIX->value . 'seo_' . $slug,
|
||||
now()->addDay(),
|
||||
fn() => $this->seoPageProvider->getSeoForModel($additionalEducationModel)
|
||||
);
|
||||
|
||||
$additionalEducation = new AdditionalEducationResource($additionalEducationModel);
|
||||
|
||||
|
||||
return Inertia::render('Client/Additional-educations/Show', compact(
|
||||
'additionalEducation',
|
||||
|
||||
Reference in New Issue
Block a user