Browse

@php $department = Auth::user()->department; // Filter chips: only departments that actually have courses, plus company-wide $filters = collect(['all' => 'All']) ->merge($courses->pluck('department')->filter()->unique()->sort()->mapWithKeys(fn ($d) => [$d => $d])) ->when($courses->contains('department', null), fn ($f) => $f->put('general', 'All staff')); @endphp {{-- Recommended --}}

{{ $department ? "Recommended for {$department}" : 'Popular with your colleagues' }}

{{ $department ? "Courses for people who work in {$department} that you haven't started yet." : 'Most-taken courses you haven\'t started. Ask your admin to set your department for picks that fit your role.' }}

@if ($recommended->isEmpty())
You've started every course for {{ $department ?? 'your team' }}. The full catalogue is below.
@else
@foreach ($recommended as $course) @endforeach
@endif
{{-- Full catalogue --}}

All courses

@foreach ($filters as $key => $label) @endforeach
@foreach ($courses as $course) @endforeach