@inject('carbon', 'Carbon\Carbon') @php $grandTotal = 0; // Initialize total price accumulator @endphp @foreach($extensions as $extension) @endforeach
Ancien checkout Nouveau checkout Prix / nuit Prix total
{{ $carbon::parse($extension->last_check_out)->format('d-m-Y') }} {{ $carbon::parse($extension->check_out)->format('d-m-Y') }} {{ number_format($extension->night_price, 2) }} TND @php $days = $carbon::parse($extension->check_out)->diffInDays($carbon::parse($extension->last_check_out)); $totalPrice = $days * $extension->night_price; $grandTotal += $totalPrice; // Add the total price to the grand total @endphp {{ number_format($totalPrice, 2) }} TND
Total {{ number_format($grandTotal, 2) }} TND