Implement ticket links and blocker state
This commit is contained in:
@@ -12,7 +12,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
#[Fillable([
|
||||
'acceptance_criteria',
|
||||
'board_column_id',
|
||||
'blocked_comment',
|
||||
'description',
|
||||
'is_blocked',
|
||||
'parent_ticket_id',
|
||||
'project_id',
|
||||
'sequence_number',
|
||||
@@ -26,6 +28,16 @@ class Ticket extends Model
|
||||
/** @use HasFactory<TicketFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_blocked' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function boardColumn(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BoardColumn::class);
|
||||
@@ -48,6 +60,18 @@ class Ticket extends Model
|
||||
return $this->belongsTo(Ticket::class, 'parent_ticket_id');
|
||||
}
|
||||
|
||||
public function ticketLinksAsSource(): HasMany
|
||||
{
|
||||
return $this->hasMany(TicketLink::class, 'source_ticket_id')
|
||||
->orderBy('id');
|
||||
}
|
||||
|
||||
public function ticketLinksAsTarget(): HasMany
|
||||
{
|
||||
return $this->hasMany(TicketLink::class, 'target_ticket_id')
|
||||
->orderBy('id');
|
||||
}
|
||||
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
|
||||
Reference in New Issue
Block a user