refactor(backend): reorganize domains into Core, Commerce, Ticketing and Shared

This commit is contained in:
2026-09-18 10:14:02 -03:00
parent 4659c1049d
commit 1241e1f7e8
425 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Domains\Ticket\Models;
use App\Domains\Auth\Models\User;
use App\Domains\Purchase\Models\PurchaseItem;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable([
'ticket_id',
'purchase_item_id',
'created_by_user_id',
'type',
'amount',
])]
class TicketRefund extends Model
{
public const TYPE_PARTIAL = 'partial';
public const TYPE_TOTAL = 'total';
protected function casts(): array
{
return [
'ticket_id' => 'integer',
'purchase_item_id' => 'integer',
'created_by_user_id' => 'integer',
'amount' => 'decimal:2',
];
}
/** @return list<string> */
public static function types(): array
{
return [self::TYPE_PARTIAL, self::TYPE_TOTAL];
}
public function typeLabel(): string
{
return match ($this->type) {
self::TYPE_PARTIAL => 'Reembolso parcial',
self::TYPE_TOTAL => 'Reembolso total',
default => 'Reembolsado',
};
}
/** @return BelongsTo<Ticket, $this> */
public function ticket(): BelongsTo
{
return $this->belongsTo(Ticket::class);
}
/** @return BelongsTo<PurchaseItem, $this> */
public function purchaseItem(): BelongsTo
{
return $this->belongsTo(PurchaseItem::class);
}
/** @return BelongsTo<User, $this> */
public function createdBy(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by_user_id')->withTrashed();
}
}