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
+24 -4
View File
@@ -37,18 +37,38 @@ class User extends Authenticatable
->where('status', QrTeamMember::STATUS_ACTIVE);
}
public function posMemberships(): HasMany
{
return $this->hasMany(PosMember::class, 'user_ref', 'public_id');
}
public function canAccessAccount(int $accountId): bool
{
return $accountId === $this->id
|| $this->memberships()->where('account_id', $accountId)->exists();
if ($accountId === $this->id) {
return true;
}
if ($this->memberships()->where('account_id', $accountId)->exists()) {
return true;
}
$account = self::find($accountId);
return $account !== null
&& $this->posMemberships()->where('owner_ref', $account->public_id)->exists();
}
/** @return Collection<int, User> */
public function accessibleAccounts(): Collection
{
$ids = $this->memberships()->pluck('account_id')->all();
$qrIds = $this->memberships()->pluck('account_id')->all();
$posOwnerRefs = $this->posMemberships()->pluck('owner_ref')->all();
return collect([$this])->merge(self::whereIn('id', $ids)->get())->unique('id')->values();
return collect([$this])
->merge(self::whereIn('id', $qrIds)->get())
->merge(self::whereIn('public_id', $posOwnerRefs)->get())
->unique('id')
->values();
}
public function avatarUrl(): ?string