File manager - Edit - /var/www/html/portal/app/Http/Resources/AcaoSocial/CentrosDeReferencia/CentrosDeReferenciaResource.php
Back
<?php namespace App\Http\Resources\AcaoSocial\CentrosDeReferencia; use App\Models\AcaoSocial\CentrosDeReferencia\Centro; use App\Helpers\FileUploadHelper; class CentrosDeReferenciaResource { public static function getPathImageCentroDeReferenciaField($request, string $inputName, ?Centro $centro = null) { $ds = DIRECTORY_SEPARATOR; if ($centro && isset($centro->id) && $centro->photo) { $path = $centro->foto; } else { $path = "pmar{$ds}assets{$ds}img{$ds}icons{$ds}centro_referencia.png"; } if ($request->hasFile($inputName) && $request->file($inputName)->isValid()) { $file = $request->file($inputName); $uploadedPath = FileUploadHelper::processSafeImageUpload($file, 'centros'); if ($uploadedPath) { $path = $uploadedPath; } } return $path; } public static function handleFileDestroyImageCentroDeReferencia($path, string $default = "pmar/assets/img/icons/centro_referencia.png"): bool { $ds = DIRECTORY_SEPARATOR; if ($path != $default) { $search = "pmar{$ds}assets{$ds}img"; $file_exist = storage_path() . str_replace($search, "{$ds}app{$ds}public", $path); if (@file_exists($file_exist)) { @unlink($file_exist); } } return true; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings