@foreach($bookReturn as $key=> $list) @php $startDate = Carbon::parse($list->getIssuedetails->getisseuBook->issue_date); $endDate = Carbon::parse($list->return_date); // Calculate the number of days between the two dates $numberOfDays = $startDate->diffInDays($endDate); @endphp @php $key++; @endphp