Model ticket link counterparts explicitly
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user