Files
ladill-care/app/Models/Shift.php
T
isaaccladandCursor b2cebe2908
Deploy Ladill Care / deploy (push) Successful in 1m0s
Add shift templates, unit duty roster grid, and Nursing Services hub.
Phase 3 staff management: real shift entities, week roster linked to temporary assignments, and a nursing ops module surface (registry, today’s allocation, unit shortcuts).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-20 10:40:25 +00:00

55 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use App\Models\Concerns\BelongsToOwner;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Shift extends Model
{
use BelongsToOwner, SoftDeletes;
protected $table = 'care_shifts';
protected $fillable = [
'owner_ref',
'organization_id',
'code',
'label',
'start_time',
'end_time',
'color',
'sort_order',
'is_active',
];
protected function casts(): array
{
return [
'is_active' => 'boolean',
'sort_order' => 'integer',
];
}
public function organization(): BelongsTo
{
return $this->belongsTo(Organization::class, 'organization_id');
}
public function rosterEntries(): HasMany
{
return $this->hasMany(RosterEntry::class, 'shift_id');
}
public function timeLabel(): string
{
$start = substr((string) $this->start_time, 0, 5);
$end = substr((string) $this->end_time, 0, 5);
return $start.''.$end;
}
}