@php $types = [ "Fő fotó", "Hátulja", "Cikkszám", "Csatlakozó", "Futófelület", "További fotó", ]; if( !$item->part->is_required_connector_photo ) { unset($types[3]); } $product_photos = []; foreach($types as $photo_type) { $photo = $photos->where('type', $photo_type)->first(); if( !$photo ) { $photo = new App\Models\Photo; $photo['product_id'] = $item->id; $photo['type'] = $photo_type; } $product_photos[$photo_type] = $photo; } @endphp
@foreach ($types as $photo_type)
{{ $photo_type }}
@php $formId = 'product_photo_'.rand(0,100); $id = $product_photos[$photo_type]?->id; @endphp @include('product.form.photo')
@endforeach