@extends('layouts.template') @section('content')

Add Trip Lifecycle for Booking Id : {{$data->booking_id}}

@php $raw = $data->stay_date; // The double-encoded JSON string $firstDecode = json_decode($raw, true); // returns a JSON string $dates = json_decode($firstDecode, true); // returns the actual PHP array $existing = $existingLifeCycles ?? collect(); $existingLifeCycles @endphp
@csrf
    @for($i = 0; $i < count($dates); $i++) @php $dateString=\Carbon\Carbon::parse($dates[$i])->format('Y-m-d'); $lifecycle = $existing->get($dateString); @endphp
  • Day {{$i+1}}

    {{$dates[$i]}} Actual KM: {{$lifecycle->actual_km}}

  • @endfor
@endsection