Add multi-branch POS with team roles and branch-scoped cashiers.
Deploy Ladill POS / deploy (push) Successful in 1m58s

Pro and Business users can manage branches, invite cashiers with branch assignment, and switch registers; sales and register flows respect acting location.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-08 06:05:30 +00:00
co-authored by Cursor
parent cac7c60415
commit 9d7dac6c24
34 changed files with 1434 additions and 30 deletions
+30
View File
@@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use App\Models\PosLocation;
use App\Models\User;
use Closure;
use Illuminate\Http\Request;
@@ -26,6 +27,8 @@ class SetActingAccount
}
}
$accountId = $this->preferEmployerAccount($request, $user, $accountId);
$account = $accountId === $user->id ? $user : (User::find($accountId) ?? $user);
$request->attributes->set('actingAccount', $account);
@@ -38,4 +41,31 @@ class SetActingAccount
return $next($request);
}
private function preferEmployerAccount(Request $request, User $user, int $accountId): int
{
if ($accountId !== $user->id) {
return $accountId;
}
if (PosLocation::owned($user->public_id)->exists()) {
return $accountId;
}
$membership = $user->posMemberships()->first();
if (! $membership) {
return $accountId;
}
$employer = User::where('public_id', $membership->owner_ref)->first();
if ($employer && $user->canAccessAccount($employer->id)) {
if (! $request->is('api/*')) {
$request->session()->put('ladill_account', $employer->id);
}
return $employer->id;
}
return $accountId;
}
}