'navbar', 'middleware' => ['web']], function () { Route::get('/redirect/{linkId}', function($linkId) { try { $link = NavbarLink::findOrFail($linkId); if (!$link->is_active) { abort(404); } if ($link->link_type === 'path' && $link->custom_path) { return redirect($link->custom_path); } elseif ($link->link_type === 'url' && $link->custom_url) { return redirect($link->custom_url); } abort(404); } catch (\Exception $e) { \Log::error('NavbarManager: Redirect failed', [ 'link_id' => $linkId, 'error' => $e->getMessage() ]); abort(404); } })->name('navbar.redirect'); });