@php $nav = [ 'Periods & rooms' => 'timetable.periods', 'Lesson cards' => 'timetable.lesson-cards', 'Constraints' => 'timetable.constraints', 'Generate' => 'timetable.generate', 'View grid' => 'timetable.view', 'Edit grid' => 'timetable.edit', 'Relationships' => 'timetable.relationships', 'Substitutions' => 'timetable.substitutions', ]; $current = request()->route()?->getName() ?? ''; $active = null; foreach ($nav as $label => $route) { if ($current === $route || str_starts_with($current, $route . '.')) { $active = $label; break; } } if (!$active && str_starts_with($current, 'timetable.view')) { $active = 'View grid'; } if (!$active && str_starts_with($current, 'timetable.edit')) { $active = 'Edit grid'; } @endphp
@foreach($nav as $label => $route) {{ $label }} @endforeach