Problem
The package exposes switchWorkspace(), currentWorkspace(), and currentOrDefaultWorkspace() on the HasWorkspaces trait, plus a switchTo controller action. But:
- No storage —
currentWorkspace() only works if the host app implements getCurrentWorkspaceId()/setCurrentWorkspaceId(). Every consumer reinvents this.
- No read endpoint — there's no
GET /workspaces/current to fetch the active workspace, so each app maintains a bespoke controller for it.
What we do today (workaround)
In the host app we back the hooks with whilesmart/eloquent-model-configuration, storing current_workspace_id as a user config value, and we keep a one-method app controller just to expose the current workspace (id, name, currency) to the frontend.
Proposed
- Provide a default storage implementation for current workspace (optionally via eloquent-model-configuration when present, else a
current_workspace_id column / cache), so apps don't implement the hooks themselves.
- Add a
GET /workspaces/current endpoint returning the current-or-default workspace, so the bespoke app controller can be dropped.
Tracking the app-side glue against this issue.
Problem
The package exposes
switchWorkspace(),currentWorkspace(), andcurrentOrDefaultWorkspace()on theHasWorkspacestrait, plus aswitchTocontroller action. But:currentWorkspace()only works if the host app implementsgetCurrentWorkspaceId()/setCurrentWorkspaceId(). Every consumer reinvents this.GET /workspaces/currentto fetch the active workspace, so each app maintains a bespoke controller for it.What we do today (workaround)
In the host app we back the hooks with
whilesmart/eloquent-model-configuration, storingcurrent_workspace_idas a user config value, and we keep a one-method app controller just to expose the current workspace (id, name, currency) to the frontend.Proposed
current_workspace_idcolumn / cache), so apps don't implement the hooks themselves.GET /workspaces/currentendpoint returning the current-or-default workspace, so the bespoke app controller can be dropped.Tracking the app-side glue against this issue.