@php // Group the staff by designation $staffsByDesignation = $staffs->flatMap(fn($group) => $group) // flatten all inner collections ->unique('id') // remove duplicate staff ->groupBy('designations'); // group by designation @endphp @foreach ($staffsByDesignation as $designation => $staffGroup) {{--
{{ $staff->designations }}
@if($staff->showappointment)@lang('language.appointmentdate') {{ getNepaliDate($staff->appointment_date) }}
@endif