Conveyance

Item Type Actual Price ({{ $itenary->currencycode }} ) @php // Get an array of conveyance IDs, conveyance type IDs, and their actual prices from the backend function $conveyanceData = $conveyanceIds; // Convert conveyanceData to a more usable structure by combining conveyances_id and conveyance_type_id as a composite key $conveyanceArray = collect($conveyanceData)->keyBy(function($item) { return $item['conveyances_id'] . '-' . $item['conveyance_type_id']; }); @endphp @foreach($itenary->additional_conveyances as $conveyance) @php // Create a composite key based on conveyance id and conveyance type id $compositeKey = $conveyance['id'] . '-' . $conveyance['conveyance_type_id']; // Check if the composite key exists in the returned data $isSelected = $conveyanceArray->has($compositeKey); // Get the actual price if conveyance exists, otherwise set to 0 $actualPrice = $isSelected ? $conveyanceArray[$compositeKey]['actual_price'] : 0; @endphp {{ $conveyance['owner_name'] }} {{ $conveyance['conveyance_type_names'] }} @endforeach