Skip to content

Commit

Permalink
[TM-1624] Provide a parent name attribute on reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Jan 17, 2025
1 parent 8cad6dd commit 4483222
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Models/V2/Nurseries/NurseryReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,9 @@ public function getAuditableNameAttribute(): string
{
return $this->title ?? '';
}

public function getParentNameAttribute(): string
{
return $this->nursery?->name ?? '';
}
}
5 changes: 5 additions & 0 deletions app/Models/V2/Projects/ProjectReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,4 +531,9 @@ public function scopeApproved($query)
{
return $query->where('status', ReportStatusStateMachine::APPROVED);
}

public function getParentNameAttribute(): string
{
return $this->project?->name ?? '';
}
}
5 changes: 5 additions & 0 deletions app/Models/V2/Sites/SiteReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ public function getAuditableNameAttribute(): string
return $this->title ?? '';
}

public function getParentNameAttribute(): string
{
return $this->site?->name ?? '';
}

public static function search($query)
{
return self::select('v2_site_reports.*')
Expand Down

0 comments on commit 4483222

Please sign in to comment.