refactor ClientProgramController; replace caching logic with action classes for educational program retrieval and enhance code clarity
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Education\Tasks;
|
||||
|
||||
use App\Ship\Contracts\SeoServiceInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class GetSeoForModelTask
|
||||
{
|
||||
public function run(SeoServiceInterface $seoPageProvider, Model $model)
|
||||
{
|
||||
$cacheKeySeo = 'education_program_seo_' . md5($model->slug);
|
||||
return Cache::remember($cacheKeySeo, now()->addHours(1), function () use ($seoPageProvider, $model) {
|
||||
return $seoPageProvider->getSeoForModel($model);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user