Month @if (!empty($feeChallan['student_fee_tag']) && $feeChallan['student_fee_tag'] == 'Quarter') {{ \Carbon\Carbon::create($feeChallan['challan_year_from'], $feeChallan['challan_month_from'], 1)->format('M Y') }} - {{ \Carbon\Carbon::create($feeChallan['challan_year_to'], $feeChallan['challan_month_to'], 1)->format('M Y') }} @elseif (empty($feeChallan['student_fee_tag'])) @php $start = \Carbon\Carbon::create( $feeChallan['challan_year_from'], $feeChallan['challan_month_from'], 1, ); $end = \Carbon\Carbon::create( $feeChallan['challan_year_to'], $feeChallan['challan_month_to'], 1, ); $dates = []; while ($start->lte($end)) { $dates[] = $start->format('M Y'); $start->addMonth(); } @endphp {{ implode(', ', $dates) }} @else {{ \Carbon\Carbon::create($feeChallan['challan_year_from'], $feeChallan['challan_month_from'], 1)->format('M Y') }} @endif