feat(ticket): add action capability helpers and expose them in admin resource
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user