Merge remote-tracking branch 'origin/master' into Development

This commit is contained in:
Simon Pocrnjič
2025-12-21 21:22:36 +01:00
10 changed files with 481 additions and 338 deletions
+17
View File
@@ -112,6 +112,11 @@ public function segments(): BelongsToMany
->wherePivot('active', true);
}
public function attachedSegments(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Segment::class);
}
public function account(): HasOne
{
// Use latestOfMany to always surface newest account snapshot if multiple exist.
@@ -130,6 +135,18 @@ public function documents(): MorphMany
return $this->morphMany(\App\Models\Document::class, 'documentable');
}
public function fieldJobs(): HasMany
{
return $this->hasMany(\App\Models\FieldJob::class);
}
public function latestObject(): HasOne
{
return $this->hasOne(\App\Models\CaseObject::class)
->whereNull('deleted_at')
->latest();
}
protected static function booted(): void
{
static::created(function (Contract $contract): void {