@php
$fotoTypes = [
'upload_gs',
'foto_sentuh_tanahku',
'foto_gistaru',
'foto_bhumi',
'foto_argis_region',
'foto_tempat',
];
$customLabels = [
'upload_gs' => 'Gambar Situasi',
'foto_sentuh_tanahku' => 'Sentuh Tanahku',
'foto_gistaru' => 'Gistaru',
'foto_bhumi' => 'Bhumi',
'foto_argis_region' => 'Blad Tata Ruang ',
'foto_tempat' => 'Peta Lokasi',
];
// Memindahkan foto_tempat ke depan jika ada
if (($key = array_search('upload_gs', $fotoTypes)) !== false) {
unset($fotoTypes[$key]);
array_unshift($fotoTypes, 'upload_gs');
}
// Filter fotoTypes untuk memastikan hanya yang memiliki imagePath valid
$validPhotoTypes = array_filter($fotoTypes, function ($type) use ($forminspeksi) {
// Check if value is a string (not an array) and file exists
return isset($forminspeksi[$type]) &&
is_string($forminspeksi[$type]) &&
file_exists(storage_path('app/public/' . $forminspeksi[$type]));
});
@endphp
@foreach ($validPhotoTypes as $type)
@php
$imagePath = $forminspeksi[$type] ?? null;
@endphp
@if ($imagePath && file_exists(storage_path('app/public/' . $imagePath)))
|
{{ $customLabels[$type] ?? '' }}
|
@endif
@endforeach