/
vladislavts
/
gcppmsp
Обзор
Документация
Войти
/
vladislavts
/
gcppmsp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
prod
src/Twig/AppUploadedAsset.php
29 строк
815 B
Vladislav
ciunt service on filial
28 ноя 2023, 20:22
28 ноя 2023, 20:22
bb86341
Код
Авторство
О чём код?
<?php namespace App\Twig; use Symfony\Component\Asset\Packages; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Twig\Extension\RuntimeExtensionInterface; class AppUploadedAsset implements RuntimeExtensionInterface { private ParameterBagInterface $parameterBag; private Packages $packages; public function __construct(ParameterBagInterface $parameterBag, Packages $packages) { $this->parameterBag = $parameterBag; $this->packages = $packages; } public function uploaded_asset(?string $config, ?string $path) { // dd($path); if (!$config) $config = "filial_uploads"; if (!$path) $path = "165a-65009d6c154a8.jpg"; return $this->packages->getUrl($this->parameterBag->get($config) . '/' . $path); } }