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

21 lines
493 B
PHP
Executable File

<?php
namespace App\Containers\Widget\Tasks;
use App\Containers\AppStructure\Models\Page;
use Illuminate\Support\Facades\Cache;
class FindPageByIdTask
{
public function run(int $id)
{
$cacheKey = 'page_' . md5($id);
return Cache::remember($cacheKey, now()->addHours(1), function () use ($id) {
return Page::where('id', '=', $id)
->with('section.pages.section', 'section.mainSection')
->firstOrFail();
});
}
}