refactor(backend): reorganize domains into Core, Commerce, Ticketing and Shared
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Sale\Resources\AdminApp;
|
||||
|
||||
use App\Domains\Purchase\Models\Purchase;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin Purchase */
|
||||
class SaleResource extends JsonResource
|
||||
{
|
||||
/** @return array<string, mixed> */
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$ticketsCount = (int) ($this->tickets_count ?? 0);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'created_at' => $this->created_at,
|
||||
'customer_name' => $this->nombre_apellido,
|
||||
'quantity' => (int) ($this->quantity ?? 0),
|
||||
'status' => $this->status,
|
||||
'admin_status' => Purchase::adminStatusFor($this->status),
|
||||
'status_label' => Purchase::adminStatusNameFor($this->status),
|
||||
'total' => number_format((float) $this->total, 2, '.', ''),
|
||||
'tickets_count' => $ticketsCount,
|
||||
'has_generated_tickets' => $ticketsCount > 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user