Files
ladill-care/app/Models/Member.php
T
isaaccladandCursor 3735be3425
Deploy Ladill Care / deploy (push) Successful in 1m8s
Add Care Units, beds, and dated staff assignments.
Models employment as department/unit/shift placements with primary and temporary kinds so nurses are not permanently bound to a ward.

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

38 lines
898 B
PHP

<?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;
class Member extends Model
{
use BelongsToOwner;
protected $table = 'care_members';
protected $fillable = ['owner_ref', 'organization_id', 'user_ref', 'role', 'branch_id'];
public function organization(): BelongsTo
{
return $this->belongsTo(Organization::class, 'organization_id');
}
public function branch(): BelongsTo
{
return $this->belongsTo(Branch::class, 'branch_id');
}
public function staffAssignments(): HasMany
{
return $this->hasMany(StaffAssignment::class, 'member_id');
}
public function hasRole(string ...$roles): bool
{
return in_array($this->role, $roles, true);
}
}