@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) {{--

{{ $designation }}

--}} @foreach ($staffGroup->chunk(4) as $chunk)
@foreach ($chunk as $staff)
{{ $staff->title }}

{{ $staff->title }}

{{ $staff->designations }}

@if($staff->showappointment)

@lang('language.appointmentdate') {{ getNepaliDate($staff->appointment_date) }}

@endif
@endforeach
@endforeach @endforeach