fix(branches): stop the branch switcher 500ing on an unbuilt executive view
config/branch_lock.php names executive.dashboard as the lock's destination,
but that route was never built. route() throws on an undefined name, so
switching to "كل الفروع" crashed in production after the session had already
been written — the user landed in all-branches mode via an error page.
isLocked() already refused to lock without the route, and that was believed
to make the whole feature dormant. It only made the *gating* dormant: the
guard sits on the decision, while the crash is at the dereference. Four other
sites turned the same name into a URL, and BranchSwitcher's was outside the
gate entirely. Auth/Login reached it only through the config key, so it does
not even contain the string "executive".
Route every caller through BranchContext::redirectRouteName(), which returns
the configured route when it exists and degrades to the dashboard when it
does not. The dashboard is the right fallback while the view is unbuilt: the
lock is dormant, so it is already unfiltered and showing the every-branch
numbers the user asked for.
The test pins the resolver in both directions and fails if any Livewire
component or middleware reads branch_lock.redirect_route directly again.
Co-Authored-By:
Claude Opus 5 (1M context) <noreply@anthropic.com>
Showing
Please register or sign in to comment