feat(ticket): add action capability helpers and expose them in admin resource

This commit is contained in:
2026-09-11 09:25:19 -03:00
parent 5d00dc439e
commit 2ddb046c26
4 changed files with 77 additions and 4 deletions

View File

@@ -150,6 +150,51 @@ class Ticket extends Model
return $this->allow_refund();
}
public function is_active(): bool
{
return $this->status === self::STATUS_ACTIVE;
}
public function isActive(): bool
{
return $this->is_active();
}
public function getIsActiveAttribute(): bool
{
return $this->is_active();
}
public function can_cancel(): bool
{
return $this->is_active();
}
public function canCancel(): bool
{
return $this->can_cancel();
}
public function getCanCancelAttribute(): bool
{
return $this->can_cancel();
}
public function can_refund(): bool
{
return $this->is_active() && $this->allow_refund();
}
public function canRefund(): bool
{
return $this->can_refund();
}
public function getCanRefundAttribute(): bool
{
return $this->can_refund();
}
/** @return BelongsTo<User, $this> */
public function user(): BelongsTo
{