File manager - Edit - /var/www/html/portal/app/Http/Resources/MeioAmbiente/CastracaoAnimal/CastracaoAnimaisResource.php
Back
<?php namespace App\Http\Resources\MeioAmbiente\CastracaoAnimal; use App\Models\MeioAmbiente\CastracaoAnimal\Animal; use App\Helpers\FileUploadHelper; class CastracaoAnimaisResource { public static function getPathImageAnimalField($request, string $inputName, ?Animal $animal = null) { $ds = DIRECTORY_SEPARATOR; if ($animal && isset($animal->id) && $animal->photo) { $path = $animal->photo; } else { $path = "pmar{$ds}assets{$ds}img{$ds}icons{$ds}animal.png"; } if ($request->hasFile($inputName) && $request->file($inputName)->isValid()) { $file = $request->file($inputName); $uploadedPath = FileUploadHelper::processSafeImageUpload($file, 'arquivos'); if ($uploadedPath) { $path = $uploadedPath; } } return $path; } public static function handleFileDestroyImageAnimal($path, string $default = "pmar/assets/img/icons/animal.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.01 |
proxy
|
phpinfo
|
Settings