update api register
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Voucher;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class VoucherAgentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id, 'uuid' => $this->uuid, 'tenant_id' => $this->tenant_id,
|
||||
'user_id' => $this->user_id, 'user' => $this->whenLoaded('user'), 'agent_code' => $this->agent_code,
|
||||
'payment_type' => $this->payment_type, 'price_mode' => $this->price_mode,
|
||||
'discount_percent' => $this->discount_percent, 'commission_percent' => $this->commission_percent,
|
||||
'credit_limit' => $this->credit_limit, 'outstanding_balance' => $this->outstanding_balance,
|
||||
'status' => $this->status, 'notes' => $this->notes, 'created_at' => $this->created_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Voucher;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class VoucherSaleResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id, 'uuid' => $this->uuid, 'sale_number' => $this->sale_number,
|
||||
'agent' => $this->whenLoaded('agent'), 'package_profile' => $this->whenLoaded('packageProfile'),
|
||||
'creator' => $this->whenLoaded('creator'), 'quantity' => $this->quantity, 'unit_price' => $this->unit_price,
|
||||
'discount_amount' => $this->discount_amount, 'total_amount' => $this->total_amount,
|
||||
'payment_status' => $this->payment_status, 'status' => $this->status, 'created_at' => $this->created_at,
|
||||
'vouchers' => $this->whenLoaded('vouchers', fn () => $this->vouchers->map(fn ($voucher) => [
|
||||
'id' => $voucher->id, 'uuid' => $voucher->uuid, 'username' => $voucher->username,
|
||||
'password' => $voucher->access_password, 'status' => $voucher->status, 'sync_status' => $voucher->sync_status,
|
||||
'mikrotik' => $voucher->mikrotik, 'valid_until' => $voucher->valid_until,
|
||||
])),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user