Allow explicit multi-branch practitioner assignment for telemedicine.
Deploy Ladill Care / deploy (push) Successful in 1m29s
Deploy Ladill Care / deploy (push) Successful in 1m29s
Replace optional “All branches” with required branch checkboxes; doctors may switch only among assigned sites, never org-wide by default. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -58,12 +58,20 @@ trait ScopesToAccount
|
||||
|
||||
protected function scopeToBranch(Request $request, Builder $query, string $column = 'branch_id'): Builder
|
||||
{
|
||||
$branchId = app(OrganizationResolver::class)->branchScope($this->member($request));
|
||||
$allowed = app(OrganizationResolver::class)->allowedBranchIds($this->member($request));
|
||||
|
||||
if ($branchId !== null) {
|
||||
$query->where($column, $branchId);
|
||||
if ($allowed !== null) {
|
||||
$query->whereIn($column, $allowed !== [] ? $allowed : [0]);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
protected function authorizeBranch(Request $request, ?int $branchId): void
|
||||
{
|
||||
abort_unless(
|
||||
app(OrganizationResolver::class)->mayAccessBranch($this->member($request), $branchId),
|
||||
404,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user