Seed investigation types early (before clinical data), expand the default catalog, scope Lab → Catalog by organization, and harden practitioner-branch sync so a mid-reseed failure cannot wipe the catalog. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -85,6 +85,13 @@ class Practitioner extends Model
|
||||
*/
|
||||
public function syncAssignedBranches(array $branchIds): void
|
||||
{
|
||||
if (! \Illuminate\Support\Facades\Schema::hasTable('care_practitioner_branch')) {
|
||||
$ids = array_values(array_unique(array_filter(array_map('intval', $branchIds))));
|
||||
$this->forceFill(['branch_id' => $ids[0] ?? null])->save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = array_values(array_unique(array_filter(array_map('intval', $branchIds))));
|
||||
$this->branches()->sync($ids);
|
||||
$this->forceFill([
|
||||
|
||||
Reference in New Issue
Block a user