Separate unit placements from shift duty assignments.
Deploy Ladill Care / deploy (push) Successful in 30s
Deploy Ladill Care / deploy (push) Successful in 30s
Roster no longer writes temporary staff assignments; unit assignment UI drops shift fields and labels clarify the two workflows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,6 +7,7 @@ use Carbon\CarbonInterface;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StaffAssignment extends Model
|
||||
@@ -58,6 +59,20 @@ class StaffAssignment extends Model
|
||||
return $this->belongsTo(CareUnit::class, 'care_unit_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy link from when duty roster auto-created unit placements.
|
||||
* Shift assignments live on RosterEntry; new roster rows do not set this.
|
||||
*/
|
||||
public function rosterEntries(): HasMany
|
||||
{
|
||||
return $this->hasMany(RosterEntry::class, 'staff_assignment_id');
|
||||
}
|
||||
|
||||
public function scopeUnitPlacements(Builder $query): Builder
|
||||
{
|
||||
return $query->whereDoesntHave('rosterEntries');
|
||||
}
|
||||
|
||||
public function scopeEffectiveOn(Builder $query, CarbonInterface|string|null $date = null): Builder
|
||||
{
|
||||
$day = $date
|
||||
|
||||
Reference in New Issue
Block a user