Files
2026-04-08 14:14:38 +05:00

21 lines
521 B
PHP
Executable File

<?php
namespace App\Containers\AppStructure\Tasks;
use App\Containers\AppStructure\Models\Page;
use Illuminate\Support\Facades\Cache;
class FindPageByPathTask
{
public function run(string $path): ?Page
{
$cacheKey = 'page_data_' . md5($path);
return Cache::remember($cacheKey, now()->addHours(48), function () use ($path) {
return Page::where('path', '=', $path)
->with('section.pages.section', 'section.mainSection')
->first();
});
}
}