Model ticket link counterparts explicitly
linter / quality (pull_request) Successful in 3m5s
tests / ci (8.4) (pull_request) Failing after 1m41s

This commit is contained in:
2026-05-23 10:29:22 +00:00
parent d60c33fa7c
commit 486994e441
22 changed files with 312 additions and 66 deletions
+11 -1
View File
@@ -9,12 +9,22 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
#[Fillable(['label', 'position', 'project_id'])]
#[Fillable(['label', 'counterpart_label', 'position', 'project_id'])]
class TicketLinkType extends Model
{
/** @use HasFactory<TicketLinkTypeFactory> */
use HasFactory;
public function counterpartLabel(): string
{
return $this->counterpart_label ?: $this->label;
}
public function labelForSource(bool $isSourceTicket): string
{
return $isSourceTicket ? $this->label : $this->counterpartLabel();
}
public function project(): BelongsTo
{
return $this->belongsTo(Project::class);